Skip to main content

Path Util

make-subpath

make-subpath() -> subpath 

Create a new subpath. A path is an array of subpaths.

origin:

Origin

segments:

Segments

closed:

Default: false

Closed

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() -> vector 

Get the start point of a subpath

subpath-end

subpath-end() -> 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

path:

Path

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.

path:

Input path

samples:

auto or int
Default: auto

Number of samples to use for curves

length

length() -> float Length 

Returns the sum of all segment lengths of a path.

segments:

Path segments

samples:

auto or int
Default: auto

Number of samples to take for curves

point-at

point-at() -> dictionary Dictionary with the following keys: 

Get information about a point at a given distance on a path.

path:

The path

distance:

Distance along the path

reverse:

Default: false

Travel from end to start

ignore-subpaths:

Default: true

If false consider the whole path, including sub-paths

  • 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

path:

Path

distance:

Distance to shorten the path by

reverse:

Default: false

If true, start from the end

Default: "CURVED"

Shortening mode for cubic segments

samples:

auto or int
Default: auto

Samples to take for measuring cubic segments

snap-to:

Default: none

Optional array of points to try to move the shortened segment to

normalize

normalize() -> path 

Normalize a path

path:

Input path