Constructor
new Point(x, y)
Create a point by its coordinates
Parameters:
Name | Type | Description |
---|---|---|
x |
number | x-coordinate |
y |
number | y-coordinate |
Members
x
Returns the point x coordinate
x
Sets the point x coordinate
y
Returns the point y coordinate
y
Sets the point y coordinate
Methods
copy() → {Point}
Return a copy of the point
Returns:
- Type
- Point
distance(p1) → {number}
Return the distance between two points
Parameters:
Name | Type | Description |
---|---|---|
p1 |
Point |
Returns:
- Type
- number
equals(p) → {number}
Returns true if the point is equal to another point
Parameters:
Name | Type | Description |
---|---|---|
p |
Point |
Returns:
- Type
- number
toString() → {string}
Returns the point as a string
Returns:
- Type
- string