Point3
-
class
common.Point3()
Constructors
-
common.Point3.constructor() - Point3(x: number, y: number, z: number):
Point3Creates a new point object.
Parameters
x: number
X valuey: number
Y valuez: number
Z valueReturns:
Point3
Properties
-
common.Point3.x - x: number
-
common.Point3.y - y: number
-
common.Point3.z - z: number
Methods
-
static common.Point3.createFromArray() static
createFromArray(arr: number[]):Point3Creates a point from an array of numbers
Parameters
arr: number[]
to assign fromReturns:
Point3new point set from array elements
-
static common.Point3.cross() static
Calculate cross product.
Parameters
Returns:
Point3Cross product of p1 and p2.
-
static common.Point3.distance() static
Calculate distance between two points
Parameters
Returns: number
Distance between p1 and p2
-
static common.Point3.dot() static
Calculate dot product.
Parameters
Returns: number
Dot product of p1 and p2.
-
static common.Point3.fromJson() static
fromJson(objData: unknown):Point3Creates a new [[Point3]] from an object given by [[toJson]].
Parameters
objData: unknown
An object given by [[toJson]].Returns:
Point3The prepared object.
-
static common.Point3.magnitude() static
magnitude(p:IPoint3): numberReturns the length of a vector.
Parameters
p:IPoint3Returns: number
Vector length.
-
static common.Point3.normalize() static
Normalize a vector.
Parameters
v:
IPoint3First point.Returns:
Point3A vector that is colinear to v with a length of 1.
-
static common.Point3.scale() static
Multiply all scalars of a given point by a same value
Parameters
Returns:
Point3p * k
-
static common.Point3.squaredLength() static
squaredLength(p:IPoint3): numberReturns the squared length of a vector.
Parameters
p:IPoint3Returns: number
Vector squared length.
-
static common.Point3.subtract() static
Subtract two points.
Parameters
Returns:
Point3Difference of p1 and p2.
-
static common.Point3.zero() static
zero():Point3Creates a new Point initialized to (0,0,0).
Returns:
Point3New point with all elements set to 0.
-
common.Point3.add() - add(pt:
IPoint3): thisAdds another point to this point.
Parameters
pt:
IPoint3Point to add.Returns: this
This point object.
-
common.Point3.assign() - assign(point:
IPoint3): thisSets this point equal to another point.
Parameters
point:
IPoint3The point to assign.Returns: this
This point object.
-
common.Point3.copy() - copy():
Point3Creates a copy of this point.
Returns:
Point3Copy of this point object.
-
common.Point3.equals() - equals(other:
IPoint3): booleanStrictly compares this point with another.
Parameters
other:
IPoint3Point to compare with.Returns: boolean
True if the values of this point equal those of the other.
-
common.Point3.equalsWithTolerance() - equalsWithTolerance(other:
IPoint3, tolerance: number): booleanCompares this point with another using a tolerance.
Parameters
Returns: boolean
True if the values of this point equal those of the other.
-
common.Point3.fromArray() - fromArray(arr: number[]): this
Sets this point from an array.
Parameters
arr: number[]
Array to assign from.Returns: this
This point object.
-
common.Point3.isAxis() - isAxis(): boolean
Returns a boolean value indicating if this vector lies on a major axis.
Returns: boolean
-
common.Point3.length() - length(): number
Returns the length of this vector.
Returns: number
Vector length.
-
common.Point3.negate() - negate(): this
Negates the point.
Returns: this
This object.
-
common.Point3.normalize() - normalize(): this
Normalizes the vector.
Returns: this
This object.
-
common.Point3.scale() - scale(k: number): this
Scale the point by constant value.
Parameters
k: number
Constant value to scale by.Returns: this
Point object.
-
common.Point3.set() - set(x: number, y: number, z: number): this
Sets the values of this point.
Parameters
x: number
X value to set.y: number
Y value to set.z: number
Z value to set.Returns: this
This point object.
-
common.Point3.squaredLength() - squaredLength(): number
Returns the squared length of this vector.
Returns: number
Vector squared length.
-
common.Point3.subtract() - subtract(pt:
IPoint3): thisSubtracts another point from this point.
Parameters
pt:
IPoint3Point to subtract.Returns: this
This point object.
-
common.Point3.toArray() - toArray(arr: number[]?): number[]
Sets an array from this point.
Parameters
arr: number[] = …
Array to assign.Returns: number[]