Point2
-
class
common.Point2()
Constructors
-
common.Point2.constructor() - Point2(x: number, y: number):
Point2Creates a new point
Parameters
x: number
value to set for xy: number
value to set for yReturns:
Point2
Properties
-
common.Point2.x - x: number
-
common.Point2.y - y: number
Methods
-
static common.Point2.add() static
Adds two points
Parameters
Returns:
Point2new point set to pt1 + pt2
-
static common.Point2.distance() static
Calculate distance between two points
Parameters
Returns: number
the distance between p1 and p2
-
static common.Point2.fromJson() static
fromJson(objData: unknown):Point2Creates a new [[Point2]] from an object given by [[toJson]].
Parameters
objData: unknown
An object given by [[toJson]].Returns:
Point2The prepared object.
-
static common.Point2.scale() static
Scale a point by a constant factor
Parameters
Returns:
Point2The scaled point
-
static common.Point2.subtract() static
Subtracts a point from another
Parameters
Returns:
Point2new point set to pt1 - pt2
-
static common.Point2.zero() static
zero():Point2Creates a point initialized to (0,0)
Returns:
Point2The new point
-
common.Point2.add() - add(pt:
Point2): thisAdds a point to this one
Parameters
pt:
Point2the point whose values will be addedReturns: this
the point object
-
common.Point2.assign() - assign(pt:
Point2): thisSets this point equal to another point
Parameters
pt:
Point2the point whose values will be used to set this objectReturns: this
the point object
-
common.Point2.copy() - copy():
Point2Creates a copy of this point
Returns:
Point2Copy of this point
-
common.Point2.equals() - equals(pt:
Point2): booleanCompares this point with another point
Parameters
pt:
Point2the point to compare withReturns: boolean
True if the values of this point equal the other. False otherwise.
-
common.Point2.length() - length(): number
Returns the length of this point
Returns: number
the point length
-
common.Point2.scale() - scale(k: number): this
Scales the point by a constant value
Parameters
k: number
the value to scale byReturns: this
the point object
-
common.Point2.set() - set(x: number, y: number): this
Sets the values of this point
Parameters
x: number
value to set for xy: number
value to set for yReturns: this
the point object
-
common.Point2.squaredLength() - squaredLength(): number
Returns the squared length of this vector.
Returns: number
Vector squared length.