Class: Point

Point(x, y)

class Point

Constructor

new Point(x, y)

Parameters:
Name Type Description
x Number x-coordinate of the point in 2D Euclidean plane
y Number y-coordinate of the point in 2D Euclidean plane
Source:

Members

angle

angle of the point made with the positive x-axis from the origin
Source:

distance

distance of the point from the origin
Source:

slope

slope of the point made with the positive x-axis from the origin
Source:

Methods

clone() → {Point}

clone the current point and return a new point object, so that changes made to the original will not affect the clone
Source:
Returns:
the cloned point
Type
Point

flipX() → {Point}

flip the point horizontally
Source:
Returns:
the reflected point
Type
Point

flipY() → {Point}

flip the point vertically
Source:
Returns:
the reflected point
Type
Point

rotate(angle) → {Point}

rotate the point about the origin for the given angle in radian
Parameters:
Name Type Description
angle Number angle to rotate in radian
Source:
Returns:
the rotated point
Type
Point

translate(x, y) → {Point}

translate the point by the given amount in x- and y-direction
Parameters:
Name Type Description
x Number amount to displace in the x-direction
y Number amount to displace in the y-direction
Source:
Returns:
the translated point
Type
Point

translateByVector(vector) → {Point}

translate the point by the given vector
Parameters:
Name Type Description
vector Vector the displacement of the point
Source:
Returns:
the translated point
Type
Point

update(x, y) → {Point}

update the point to the given coordinates, i.e. change the point to somewhere else
Parameters:
Name Type Description
x Number new x-coordinate of the point
y Number new y-coordinate of the point
Source:
Returns:
the updated point
Type
Point