Path Util
make-subpath
make-subpath() -> subpath
Create a new subpath. A path is an array of subpaths.
first-subpath-closed
first-subpath-closed(path: ,) -> boolean
Get if the first subpath is closed
first-subpath-start
first-subpath-start(path: ,) -> vector
Get the start position of the first path
subpath-start
subpath-start(subpath: ,) -> vector
Get the start point of a subpath
subpath-end
subpath-end(subpath: ,ignore-close-flag: ,) -> vector
Get the end point of a subpath
first-subpath-direction
first-subpath-direction(path: ,) -> vector
Get the direction at the start of the first path
last-subpath-direction
last-subpath-direction(path: ,) -> vector
Get the direction at the end of the last path
last-subpath-end
last-subpath-end(path: ,) -> vector
Get the end position of the last path
bounds
bounds() -> array
Calculates the bounding points for a list of path segments
segment-lengths
segment-lengths() -> array Array of arrays of floats containing the segment lengths
Returns an array of arrays with the lengths of all path segments. One sub-array for each subpath and its segments.
length
length() -> float Length
Returns the sum of all segment lengths of a path.
point-at
point-at() -> dictionary Dictionary with the following keys:
Get information about a point at a given distance on a path.
- point (vector) The point on the path
- previous-point (vector) Point previous to point
- direction (vector) Normalized direction vector
- subpath-index (int) Index of the subpath
- segment-index (int) Index of the segment
shorten-to
shorten-to()
Shorten a path on one or both sides
Optional array of points to try to move the shortened segment to
normalize
normalize() -> path
Normalize a path