DWVv0.37.0

Path

Source: path.js:8

Path shape.


Constructor

new Path( inputPointArray?: Array.<Point2D>, inputControlPointIndexArray?: Array.<number>, ): Path

Parameters

  • inputPointArray (Array.<Point2D>, optional) — The list of Point2D that make the path (optional).
  • inputControlPointIndexArray (Array.<number>, optional) — The list of control point of path, as indexes (optional). Note: first and last point do not need to be equal.

Instance Methods

getPoint(index: number): Point2D

Get a point of the list.

Parameters

  • index (number) — The index of the point to get (beware, no size check).

Returns

  • Point2D — The Point2D at the given index.

isControlPoint(point: Point2D): boolean

Is the given point a control point.

Parameters

  • point (Point2D) — The Point2D to check.

Returns

  • boolean — True if a control point.

getLength(): number

Get the length of the path.

Returns

  • number — The length of the path.

addPoint(point: Point2D)

Add a point to the path.

Parameters

  • point (Point2D) — The Point2D to add.

addControlPoint(point: Point2D)

Add a control point to the path.

Parameters

  • point (Point2D) — The Point2D to make a control point.

addPoints(newPointArray: Array.<Point2D>)

Add points to the path.

Parameters

  • newPointArray (Array.<Point2D>) — The list of Point2D to add.

appenPath(other: Path)

Append a Path to this one.

Parameters

  • other (Path) — The Path to append.

Instance Fields

pointArray: Array.<Point2D>

List of points.

controlPointIndexArray: Array.<number>

List of control points.