Point

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

Constructor

new Point(values)

Parameters:
NameTypeDescription
valuesArray.<number>

The point values.

Classes

Point

Methods

add(rhs) → {Point}

Add another point to this one.

Parameters:
NameTypeDescription
rhsPoint

The point to add.

Returns:

The point representing the sum of both points.

Type: 
Point

canCompare(rhs) → {boolean}

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

Parameters:
NameTypeDescription
rhsPoint

The point to compare to.

Returns:

True if both points are comparable.

Type: 
boolean

compare(rhs) → {Array.<number>}

Compare points and return different dimensions.

Parameters:
NameTypeDescription
rhsPoint

The point to compare to.

Returns:

The list of different dimensions.

Type: 
Array.<number>

equals(rhs) → {boolean}

Check for Point equality.

Parameters:
NameTypeDescription
rhsPoint

The point to compare to.

Returns:

True if both points are equal.

Type: 
boolean

get(i) → {number}

Get the point value at the given array index.

Parameters:
NameTypeDescription
inumber

The index to get.

Returns:

The value.

Type: 
number

get3D() → {Point3D}

Get the 3D part of this point.

Returns:

The Point3D.

Type: 
Point3D

getValues() → {Array.<number>}

Get the values of this point.

Returns:

The array of values.

Type: 
Array.<number>

length() → {number}

Get the length of the point.

Returns:

The length.

Type: 
number

mergeWith3D(rhs) → {Point}

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

Parameters:
NameTypeDescription
rhsPoint3D

The Point3D to merge with.

Returns:

The merge result.

Type: 
Point

toString() → {string}

Get a string representation of the point.

Returns:

The point as a string.

Type: 
string