Point2
- class Point2()
Constructors
Methods
Constructors
- Point2.constructor(x, y)
- Arguments
x (
number()
) – value to set for xy (
number()
) – value to set for y
Creates a new point
- Return type
Point2
Properties
- Point2.x
- Type
number
- Point2.y
- Type
number
Methods
static add
assign
copy
- Point2.copy()
Creates a copy of this point
- Returns
Copy of this point
- Return type
Point2
equals
length
- Point2.length()
Returns the length of this point
- Returns
the point length
- Return type
number
static scale
set
- Point2.set(x, y)
- Arguments
x (
number()
) – value to set for xy (
number()
) – value to set for y
Sets the values of this point
- Returns
the point object
- Return type
this
squaredLength
- Point2.squaredLength()
Returns the squared length of this vector.
- Returns
Vector squared length.
- Return type
number
static subtract
toJson
- Point2.toJson()
Creates an object ready for JSON serialization.
- Returns
The prepared object.
- Return type
IPoint2
static distance
static fromJson
- Point2.fromJson(objData)
- Arguments
objData (
unknown()
) – An object given by [[toJson]].
Creates a new [[Point2]] from an object given by [[toJson]].
- Returns
The prepared object.
- Return type
Point2
static fromPoint3
static zero
- Point2.zero()
Creates a point initialized to (0,0)
- Returns
The new point
- Return type
Point2