Private
lengthCache of lengthSquared.
Private
length_Cache of length.
Static
Readonly
EASTThe vector (1, 0, 0)
.
Static
Readonly
NORTHThe vector (0, 1, 0)
.
Static
Readonly
ORIGINThe vector (0, 0, 0)
.
Static
Readonly
SOUTHThe vector (0, -1, 0)
.
Static
Readonly
TINY_Static
Readonly
WESTThe vector (-1, 0, 0)
.
Returns sum of this Vector and given GenericVector.
the Vector to add
sum of this Vector and given Vector
Returns the angle going from this vector to another vector when both vectors are arranged so they start at the origin.
the other vector
angle from this vector to other vector in radians; positive means counterclockwise.
Returns distance-squared between this Vector and another GenericVector regarding both as points in space. Computationally inexpensive because it only uses multiplication, no square root.
vector to calculate distance to
distance squared between this point and the given point
Returns distance between this Vector and another GenericVector regarding both as points in space. Computationally expensive because it involves as square root.
the Vector to calculate distance to
distance between this Vector and the given point
Returns this Vector divided by the given factor.
factor by which to divide this Vector
quotient of this vector and given factor
if factor is less than TINY_POSITIVE
Returns the dot product of this Vector and the given vector.
the vector with which to form a dot product
the dot product of this Vector and the given vector
Returns true iff the other object is a GenericVector with the same values.
the object to compare to
true iff the other object is a GenericVector with the same values.
Computationally cheap version of length which avoids the square root;
returns sum of absolute value of each component x, y, z
.
sum of absolute value of each component x, y, z
.
Returns true
if this Vector is nearly equal to another Vector. The optional
tolerance value corresponds to the epsilon
in
Util.veryDifferent so
the actual tolerance used depends on the magnitude of the numbers being compared.
the vector to compare to
Optional
opt_tolerance: numberoptional tolerance for equality test
true if the vectors are similar
Returns the normalized version of this Vector, having unit length and the same direction.
normalized version of this Vector, having unit length and the same direction
if this Vector has length less than TINY_POSITIVE
Returns this Vector rotated counter-clockwise about the origin by the given angle in radians. If two parameters are given then they are the cosine and sine of the angle (this avoids calculating the sine and cosine which is computationally expensive).
the angle in radians by which to rotate this Vector, or the cosine of the angle when two parameters are given
Optional
sineAngle: numberthe sine of the angle, when two parameters are given
this Vector rotated counter-clockwise about the origin
Returns difference of this Vector and given Vector.
the vector to subtract
difference of this Vector and given vector
Static
cloneReturns an immutable Vector having the same values as the input GenericVector. If the input vector is an immutable Vector, returns that same Vector.
the GenericVector to copy
an immutable Vector with the same values as the input GenericVector
Generated using TypeDoc
An immutable vector in 3D space; after creation it cannot be altered.