| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Parses .poly files from Triangle.
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.
Full description of the .poly file format.
It can also parse .node files since they are a subset of .poly.
The file is parsed with Papa Parse.
npm install poly-parse
const polyparse = require('poly-parse');
fetch('./A.poly')
.then(result => result.text())
.then(result => {
console.log(polyparse(result));
});Output:
{
pointlist: [[0.2, -0.7764], [0.22, -0.7732] ...],
pointattributelist: [-0.57, -0.55, -0.51, -0.53 ...],
pointmarkerlist: [],
segmentlist: [[28, 0], [0, 1] ...],
segmentmarkerlist: [],
holelist: [[0.47, -0.5]],
regionlist: [],
numberofpoints: 29,
numberofpointattributes: 1,
numberofsegments: 29,
numberofholes: 1,
numberofregions: 0
}poly string with the content of the .poly file
options
Returns an object with the parsed properties.
For convenience the parsed output uses the same property names as struct triangulateio defined in triangle.h from Triangle.
Indices in a .poly file can be zero-based or one-based, but the parsed result is always zero-based.
MIT, see LICENSE for details.
| Back | FazBrowse Home | New Git URL |