Class: Point

Point

The Point object represents a location in a two-dimensional coordinate system, where x represents the position on the horizontal axis and y represents the position on the vertical axis

new Point (x, y)

Creates a new Point

Name Type Attributes Default Description
x number <optional>
0

position of the point on the x axis

y number <optional>
0

position of the point on the y axis

Implements

  • {PointLike}

Members

x number

Position of the point on the x axis

Default Value:
  • 0

y number

Position of the point on the y axis

Default Value:
  • 0

Methods

clone () Point

Creates a clone of this point

Returns:
Type Description
Point A clone of this point

copyFrom (p) this

Copies x and y from the given point into this point

Name Type Description
p PointData

The point to copy from

Returns:
Type Description
this The point instance itself

copyTo (p) T

Copies this point's x and y into the given point (p).

Name Type Description
p T

The point to copy to. Can be any of type that is or extends PointData

Returns:
Type Description
T The point (p) with values updated

equals (p) boolean

Accepts another point (p) and returns true if the given point is equal to this point

Name Type Description
p PointData

The point to check

Returns:
Type Description
boolean Returns true if both x and y are equal

set (x, y) this

Sets the point to a new x and y position. If y is omitted, both x and y will be set to x.

Name Type Attributes Default Description
x number <optional>
0

position of the point on the x axis

y number <optional>
x

position of the point on the y axis

Returns:
Type Description
this The point instance itself