Package Exports
- poly-parse
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (poly-parse) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
poly-parse
Parses a .poly file from Triangle and returns a JSON.
A .poly file represents a PSLG, as well as some additional information. PSLG stands for Planar Straight Line Graph, a term familiar to computational geometers. By definition, a PSLG is just a list of vertices and segments. A .poly file can also contain information about holes and concavities, as well as regional attributes and constraints on the areas of triangles.
The text file is parsed with Papa Parse.
Install
npm install poly-parse
Example
const polyparse = require('poly-parse');
polyparse('./A.poly', { download: true })
.then(data => console.log(data))
.catch(err => console.log(err))
Returns a Promise
with the parsed object.
{
numberofpoints: 29,
pointlist: [0.2, -0.7764, 0.22, -0.7732 ...],
pointattributelist: [-0.57, -0.55, -0.51, -0.53 ...]
...
}
For convenience the property names in the output are the same as in struct triangulateio
from Triangle.
Usage
polyparse(poly, options)
poly
Can be either the content of the .poly file as a string, or a path / URL, or a File.
options
download
set totrue
if the first argument is a path or a URL.- All the other config options from Papa Parse.
See Also
- Triangle - A Two-Dimensional Quality Mesh Generator and Delaunay Triangulator - Jonathan Shewchuk
License
MIT, see LICENSE.md for details.