new Point2d(
x?,y?):Point2d
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
get y():
number
Returns y coordinate of 2D point.
number
set y(
y):void
Sets y coordinate of 2D point.
number
Y coordinate.
void
add(
other):this
Adds other vector coordinates to this point coordinates.
Other 2D vector.
this
added(
other):Point2d
Returns new Point2d object with coordinates received by performing an add() operation to this object.
Other vector.
added(
other):Point2d
Returns new Point2d object with coordinates received by performing an add operation to this object.
Other point.
clone():
Point2d
Creates new Point object with coordinates same as this.
copy(
other):this
Copies the coordinates of the other point to this.
Copied object.
this
distance(
other):number
Returns distance between other point and this point.
Other point.
number
divide(
scalar):this
Divide this point coordinates by scalar value.
number
Scalar value.
this
divided(
scalar):Point2d
Returns new Point2d object with coordinates received by performing a divide() operation to this object.
number
Scalar value.
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
Coordinates comparison tolerance;
boolean
multiplied(
matrix):Point2d
Returns new Point2d object with coordinates received by performing a multiply() operation to this object.
2D matrix.
multiplied(
scalar):Point2d
Returns new Point2d object with coordinates received by performing a multiply() operation to this object.
number
Scalar value.
multiply(
matrix):this
Multiplies this vector coordinates with 2D matrix.
2D matrix.
this
multiply(
scalar):this
Multiplies this vector coordinates with scalar value.
number
Scalar value.
this
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 vector coordinates from this point coordinates.
Other vector.
this
subtracted(
other):Point2d
Returns new Point2d object with coordinates received by performing a subtract() operation to this object.
Other vector.
subtracted(
other):Vector2d
Returns new Point2d 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
transform(
transformation):this
Transforms coordinates of this point according to transformation.
Transformation.
this
transformed(
transformation):Point2d
Returns new Point2d object with coordinates received by performing a transform() operation to this object.
Transformation.
staticfromXY(xy):Point2d
Creates new Point2d object from object implementing BaseXY interface.
Object implementing BaseXY interface.
staticorigin():Point2d
Returns Point2d with (0, 0) coordinates.