Class: Point

Point(x, y)

Class containing a simple 2D point

Constructor

new Point(x, y)

Create a point by its coordinates
Parameters:
Name Type Description
x number x-coordinate
y number y-coordinate
Source:

Members

x

Returns the point x coordinate
Source:

x

Sets the point x coordinate
Source:

y

Returns the point y coordinate
Source:

y

Sets the point y coordinate
Source:

Methods

copy() → {Point}

Return a copy of the point
Source:
Returns:
Type
Point

distance(p1) → {number}

Return the distance between two points
Parameters:
Name Type Description
p1 Point
Source:
Returns:
Type
number

equals(p) → {number}

Returns true if the point is equal to another point
Parameters:
Name Type Description
p Point
Source:
Returns:
Type
number

toString() → {string}

Returns the point as a string
Source:
Returns:
Type
string