Implements 2D point interface and operations.
new XY(
x?,y?):XY
number
X coordinate of 2D point.
number
Y coordinate of 2D point.
get x():
number
Returns x coordinate of 2D point.
number
set x(
x):void
Sets x coordinate of 2D point.
number
X coordinate.
void
X coordinate of 2D point.
get y():
number
Returns y coordinate of 2D point.
number
set y(
y):void
Sets y coordinate of 2D point.
number
Y coordinate.
void
Y coordinate of 2D point.
add(
other):this
Adds other point coordinates to this point coordinates.
Other point.
this
added(
other):XY
Returns new XY object with coordinates received by performing a add() operation to this object.
Other point.
angle(
other):number
Returns angle between this and other points.
Other point.
number
clone():
XY
Creates new XY point with coordinates same as this.
copy(
other):this
Copies the coordinates of the other point to this.
Copied object.
this
crossed(
other):number
Returns cross product of this and other points.
Other point.
number
divide(
scalar):this
Divide this point coordinates by scalar value.
number
Scalar value.
this
divided(
scalar):XY
Returns new XY object with coordinates received by performing a divide() operation to this object.
number
Scalar value.
dot(
other):number
Returns dot product of this and other points.
Other point.
number
get(
index):number
Returns coordinate value of 2D point:
index equals 0index equals 1Throws exception if index is not in range [0, 1].
number
Coordinate index.
number
isEqual(
other,tolerance):boolean
Returns true if other point coordinates are equal to this point coordinated within provided tolerance (1e-7 by default). Returns false otherwise.
Other 2D point.
number = XY.coincidenceTolerance
Coordinates comparison tolerance;
boolean
isNormal(
other,tolerance):boolean
Returns true if other point is perpendicular to this within provided tolerance (1e-7 by default).
Other point.
number = XY.angularTolerance
boolean
isOpposite(
other,tolerance):boolean
Returns true if other point is opposite to this within provided tolerance (1e-7 by default).
Other point.
number = XY.angularTolerance
boolean
isParallel(
other,tolerance):boolean
Returns true if other point is parallel to this within provided tolerance (1e-7 by default).
Other point.
number = XY.angularTolerance
boolean
modulus():
number
Returns modulus of this point.
number
multiplied(
other):XY
Returns new XY object with coordinates received by performing a multiply() operation to this object.
Other point.
multiplied(
scalar):XY
Returns new XY object with coordinates received by performing a multiply() operation to this object.
number
Scalar value.
multiplied(
matrix):XY
Returns new XY object with coordinates received by performing a multiply() operation to this object.
2D matrix.
multiply(
other):this
Multiplies this point coordinates with other point coordinates.
Other point.
this
multiply(
matrix):this
Multiplies this point coordinates with 2D matrix.
2D matrix.
this
multiply(
scalar):this
Multiplies this point coordinates with scalar value.
number
Scalar value.
this
normalize():
this
Normalizes coordinates of this point.
this
normalized():
XY
Returns new XY object with normalized coordinates of this point.
reverse():
this
Reverses coordinates of this point.
this
reversed():
XY
Returns new XY object with coordinates received by performing a reverse() operation to this object.
set(
index,value):this
Sets coordinate value of 2D point:
index equals 0index equals 1Throws exception if index is not in range [0, 1].
number
Coordinate index.
number
Coordinate value.
this
setCoord(
x?,y?):this
Sets x and y coordinates of this object.
number
X coordinate of 2D point.
number
Y coordinate of 2D point.
this
setX(
x):this
Sets x coordinate of 2D point.
number
X coordinate.
this
setY(
y):this
Sets y coordinate of 2D point.
number
Y coordinate.
this
subtract(
other):this
Subtracts other point coordinates from this point coordinates.
Other point.
this
subtracted(
other):XY
Returns new XY object with coordinates received by performing a subtract() operation to this object.
Other point.
toJSON():
BaseXY
Returns JSON representation of this point.
toString(
precision):string
Returns string representation of this point with provided precision (3 by default).
number = 3
Precision.
string
staticfromXY(xy):XY
Creates new XY object from object implementing BaseXY interface.
Object implementing BaseXY interface.