A Vector3d object uses double precision floating point values to describe a point in 3D space.
| Name | Parameters | Return value | Notes |
| () (constructor) |
|
Vector3d |
Creates a new Vector3d object with all its coords set to 0. |
| () (constructor) |
X, Y, Z |
Vector3d |
Creates a new Vector3d object with its coords set to the specified values. |
| () (constructor) |
Vector3f |
Vector3d |
Creates a new Vector3d object by copying the coords from the given Vector3f. |
| operator * |
number |
Vector3d |
Returns a new Vector3d object with each coord multiplied. |
| operator * |
Vector3d |
Vector3d |
Returns a new Vector3d object with each coord multiplied by the corresponding coord from the given vector. |
| operator + |
Vector3d |
Vector3d |
Returns a new Vector3d containing the sum of this vector and the specified vector |
| operator - |
|
Vector3d |
Returns a new Vector3d object that is a negative of this vector (all coords multiplied by -1). |
| operator - |
Vector3d |
Vector3d |
Returns a new Vector3d object containing the difference between this object and the specified vector. |
| operator / |
number |
Vector3d |
Returns a new Vector3d object with each coord divided by the specified number. |
| operator / |
Vector3d |
Vector3d |
Returns a new Vector3d object with each coord divided by the corresponding coord from the given vector. |
| Abs |
|
|
Updates each coord to its absolute value. |
| Clamp |
min, max |
|
Clamps each coord into the specified range. |
| Cross |
Vector3d |
Vector3d |
Returns a new Vector3d that is a cross product of this vector and the specified vector. |
| Dot |
Vector3d |
number |
Returns the dot product of this vector and the specified vector. |
| Equals |
Vector3d |
bool |
Returns true if this vector is exactly equal to the specified vector. Note that this is subject to (possibly imprecise) floating point math. |
| EqualsEps |
Rhs, Eps |
boolean |
Returns true if the differences between each corresponding coords of this vector and the one specified, are less than the specified Eps. |
| Floor |
|
Vector3i |
Returns a new Vector3i object with coords set to math.floor of this vector's coords. |
| HasNonZeroLength |
|
boolean |
Returns true if the vector has at least one coord non-zero. Note that this is subject to (possibly imprecise) floating point math. |
| Length |
|
number |
Returns the (euclidean) length of the vector. |
| LineCoeffToXYPlane |
Vector3d, Z |
number |
Returns the coefficient for the line from the specified vector through this vector to reach the specified Z coord. The result satisfies the following equation: (this + Result * (Param - this)).z = Z. Returns the NO_INTERSECTION constant if there's no intersection. |
| LineCoeffToXZPlane |
Vector3d, Y |
number |
Returns the coefficient for the line from the specified vector through this vector to reach the specified Y coord. The result satisfies the following equation: (this + Result * (Param - this)).y = Y. Returns the NO_INTERSECTION constant if there's no intersection. |
| LineCoeffToYZPlane |
Vector3d, X |
number |
Returns the coefficient for the line from the specified vector through this vector to reach the specified X coord. The result satisfies the following equation: (this + Result * (Param - this)).x = X. Returns the NO_INTERSECTION constant if there's no intersection. |
| Move |
X, Y, Z |
|
Adds the specified offsets to each coord, effectively moving the vector by the specified coord offsets. |
| Move |
Diff |
|
Adds the specified vector to this vector. Is slightly better performant than adding with a "+" because this doesn't create a new object for the result. |
| Normalize |
|
|
Changes this vector so that it keeps current direction but is exactly 1 unit long. FIXME: Fails for a zero vector. |
| NormalizeCopy |
|
Vector3d |
Returns a new vector that has the same direction as this but is exactly 1 unit long. FIXME: Fails for a zero vector. |
| Set |
X, Y, Z |
|
Sets all the coords in this object. |
| SqrLength |
|
number |
Returns the (euclidean) length of this vector, squared. This operation is slightly less computationally expensive than Length(), while it conserves some properties of Length(), such as comparison. |
| TurnCCW |
|
|
Rotates the vector 90 degrees counterclockwise around the vertical axis. Note that this is specific to minecraft's axis ordering, which is X+ left, Z+ down. |
| TurnCW |
|
|
Rotates the vector 90 degrees clockwise around the vertical axis. Note that this is specific to minecraft's axis ordering, which is X+ left, Z+ down. |
| abs |
|
|
OBSOLETE, use Abs() instead. |
| clamp |
min, max |
|
OBSOLETE, use Clamp() instead. |