Point3
- class Communicator.Point3()
Constructors
Methods
Constructors
Methods
add
- Communicator.Point3.add(p1, p2)
Adds two points.
- Arguments
p1 (
Communicator.Point3()
) – First point.p2 (
Communicator.Point3()
) – Second point.
- Return type
Communicator.Point3
- Returns
Sum of p1 and p2.
assign
- Communicator.Point3.assign(point)
Sets this point equal to another point.
- Arguments
point (
Communicator.Point3()
) – The point to assign.
- Return type
Communicator.Point3
- Returns
This point object.
copy
- Communicator.Point3.copy()
Creates a copy of this point.
- Return type
Communicator.Point3
- Returns
Copy of this point object.
equals
- Communicator.Point3.equals(other)
Strictly compares this point with another.
- Arguments
other (
Communicator.Point3()
) – Point to compare with.
- Return type
boolean
- Returns
True if the values of this point equal those of the other.
equalsWithTolerance
- Communicator.Point3.equalsWithTolerance(other, tolerance)
Compares this point with another using a tolerance.
- Arguments
other (
Communicator.Point3()
) – Point to compare with.tolerance (
number()
) – Tolerance to be used in the comparison.
- Return type
boolean
- Returns
True if the values of this point equal those of the other.
forJson
- Communicator.Point3.forJson()
Note
forJson is deprecated: Use
toJson
instead.- Return type
Object
fromArray
- Communicator.Point3.fromArray(arr)
Sets this point from an array.
- Arguments
arr (
[number]()
) – Array to assign from.
- Return type
Communicator.Point3
- Returns
This point object.
isAxis
- Communicator.Point3.isAxis()
Returns a boolean value indicating if this vector lies on a major axis.
- Return type
boolean
length
- Communicator.Point3.length()
Returns the length of this vector.
- Return type
number
- Returns
Vector length.
negate
- Communicator.Point3.negate()
Negates the point.
- Return type
Communicator.Point3
- Returns
This object.
normalize
- Communicator.Point3.normalize()
Normalizes the vector.
- Return type
Communicator.Point3
- Returns
This object.
scale
- Communicator.Point3.scale(p, k)
Scale a point by a constant factor
- Arguments
p (
Communicator.Point3()
) –k (
number()
) – Constant value to scale byS
- Return type
Communicator.Point3
- Returns
Copy of p scaled by a constant factor
set
- Communicator.Point3.set(x, y, z)
Sets the values of this point.
- Arguments
x (
number()
) – X value to set.y (
number()
) – Y value to set.z (
number()
) – Z value to set.
- Return type
Communicator.Point3
- Returns
This point object.
squaredLength
- Communicator.Point3.squaredLength()
Returns the squared length of this vector.
- Return type
number
- Returns
Vector squared length.
subtract
- Communicator.Point3.subtract(p1, p2)
Subtract two points.
- Arguments
p1 (
Communicator.Point3()
) – First point.p2 (
Communicator.Point3()
) – Second point.
- Return type
Communicator.Point3
- Returns
Difference of p1 and p2.
toArray
- Communicator.Point3.toArray(arr)
Sets an array from this point.
- Arguments
arr (
[number]()
) – Array to assign.
- Return type
void
toJson
- Communicator.Point3.toJson()
Creates an object ready for JSON serialization.
- Return type
Object
- Returns
The prepared object.
construct
- Communicator.Point3.construct(obj)
Note
construct is deprecated: Use
fromJson
instead.- Arguments
obj (
any()
) –
- Return type
Communicator.Point3
createFromArray
- Communicator.Point3.createFromArray(arr)
Creates a point from an array of numbers
- Arguments
arr (
[number]()
) –
- Return type
Communicator.Point3
- Returns
new point set from array elements
cross
- Communicator.Point3.cross(p1, p2)
Calculate cross product.
- Arguments
p1 (
Communicator.Point3()
) – First point.p2 (
Communicator.Point3()
) – Second point.
- Return type
Communicator.Point3
- Returns
Cross product of p1 and p2.
distance
- Communicator.Point3.distance(p1, p2)
Calculate distance between two points
- Arguments
p1 (
Communicator.Point3()
) – First pointp2 (
Communicator.Point3()
) – Second point
- Return type
number
- Returns
Distance between p1 and p2
dot
- Communicator.Point3.dot(p1, p2)
Calculate dot product.
- Arguments
p1 (
Communicator.Point3()
) – First point.p2 (
Communicator.Point3()
) – Second point.
- Return type
number
- Returns
Dot product of p1 and p2.