Point2D

Immutable 2D point.

Constructor

new Point2D(x, y)

Parameters:
NameTypeDescription
xnumber

The X coordinate for the point.

ynumber

The Y coordinate for the point.

Classes

Point2D

Methods

equals(rhs) → {boolean}

Check for Point2D equality.

Parameters:
NameTypeDescription
rhsPoint2D

The other point to compare to.

Returns:

True if both points are equal.

Type: 
boolean

getDistance(point2D) → {number}

Get the distance to another Point2D.

Parameters:
NameTypeDescription
point2DPoint2D

The input point.

Returns:

The distance to the input point.

Type: 
number

getRound() → {Point2D}

Round a Point2D.

Returns:

The rounded point.

Type: 
Point2D

getX() → {number}

Get the X position of the point.

Returns:

The X position of the point.

Type: 
number

getY() → {number}

Get the Y position of the point.

Returns:

The Y position of the point.

Type: 
number

toString() → {string}

Get a string representation of the Point2D.

Returns:

The point as a string.

Type: 
string