a polyline
nr of points
Creates a polyline from points array with optional isClosed flag. Example: points=[[0,0,0], [1,0,0], [1,1,0]], isClosed=true → {points:..., isClosed:true}
points and info if its closed
polyline
Extracts points array from polyline object. Example: polyline={points:[[0,0,0], [1,0,0]]} → [[0,0,0], [1,0,0]]
a polyline
points
Calculates total length of polyline by summing distances between consecutive points. Example: points=[[0,0,0], [3,0,0], [3,4,0]] → 3 + 4 = 7
a polyline
length
Calculates the maximum possible half-line fillet radius for each corner of a given polyline. For a closed polyline, it includes the corners connecting the last segment back to the first.
The calculation uses the 'half-line' constraint, meaning the fillet's tangent points must lie within the first half of each segment connected to the corner.
Defines the polyline points, whether it's closed, and an optional tolerance.
An array containing the maximum fillet radius calculated for each corner. The order corresponds to corners P[1]...P[n-2] for open polylines, and P[1]...P[n-2], P[0], P[n-1] for closed polylines. Returns an empty array if the polyline has fewer than 3 points.
Finds points where polyline crosses itself (self-intersection points). Skips adjacent segments and deduplicates close points. Example: figure-8 shaped polyline → returns center crossing point
points of self intersection
polyline
Converts polyline to line segments (each segment as line object with start/end). Closed polylines include closing segment. Example: 3 points → 2 or 3 lines (depending on isClosed)
polyline
lines
Converts polyline to segment arrays (each segment as [point1, point2]). Closed polylines include closing segment if endpoints differ. Example: 4 points, closed → 4 segments connecting all points in a loop
polyline
segments
Reverses point order of polyline (flips direction). Example: points=[[0,0,0], [1,0,0], [2,0,0]] → [[2,0,0], [1,0,0], [0,0,0]]
a polyline
reversed polyline
Calculates the single safest maximum fillet radius that can be applied uniformly to all corners of a polyline, based on the 'half-line' constraint. This is determined by finding the minimum of the maximum possible fillet radii calculated for each individual corner.
Defines the polyline points, whether it's closed, and an optional tolerance.
The smallest value from the results of calculatePolylineMaxFillets. Returns 0 if the polyline has fewer than 3 points or if any calculated maximum radius is 0.
Sorts scrambled segments into connected polylines by matching endpoints. Uses spatial hashing for efficient connection finding. Example: 10 random segments that form 2 connected paths → 2 polylines
segments
polylines
Applies transformation matrix to all points in polyline (rotates, scales, or translates). Example: polyline with 4 points, translation [5,0,0] → all points moved +5 in X direction
a polyline
transformed polyline
Finds intersection points between two polylines (all segment-segment crossings). Tests all segment pairs and deduplicates close points. Example: crossing polylines forming an X → returns center intersection point
two polylines and tolerance
points
Generated using TypeDoc
Counts number of points in polyline. Example: polyline with points=[[0,0,0], [1,0,0], [1,1,0]] → 3
get
nr polyline points
false