DWVv0.37.0

Point

Source: point.js:328

Immutable point. Warning: the input array is NOT cloned, modifying it will modify the point values.


Constructor

new Point(values: Array.<number>): Point

Parameters

  • values (Array.<number>) — The point values.

Instance Methods

get(i: number): number

Get the point value at the given array index.

Parameters

  • i (number) — The index to get.

Returns

  • number — The value.

length(): number

Get the length of the point.

Returns

  • number — The length.

toString(): string

Get a string representation of the point.

Returns

  • string — The point as a string.

getValues(): Array.<number>

Get the values of this point.

Returns

  • Array.<number> — The array of values.

canCompare(rhs: Point): boolean

Check if the input point can be compared to this one.

Parameters

  • rhs (Point) — The point to compare to.

Returns

  • boolean — True if both points are comparable.

equals(rhs: Point): boolean

Check for Point equality.

Parameters

  • rhs (Point) — The point to compare to.

Returns

  • boolean — True if both points are equal.

compare(rhs: Point): Array.<number>

Compare points and return different dimensions.

Parameters

  • rhs (Point) — The point to compare to.

Returns

  • Array.<number> — The list of different dimensions.

get3D(): Point3D

Get the 3D part of this point.

Returns

add(rhs: Point): Point

Add another point to this one.

Parameters

  • rhs (Point) — The point to add.

Returns

  • Point — The point representing the sum of both points.

mergeWith3D(rhs: Point3D): Point

Merge this point with a Point3D to create a new point.

Parameters

  • rhs (Point3D) — The Point3D to merge with.

Returns

  • Point — The merge result.