Creates a new MutableVector3d instance.
The typed array containing the vector components
Gets the number of bytes per component in the underlying typed array.
The number of bytes per element (4 for Float32Array, 8 for Float64Array)
Gets the class name.
The class name "Vector3"
Gets the GLSL representation of this vector as a float vec3.
A string representation suitable for GLSL shaders
Gets the GLSL representation of this vector as an integer ivec3.
A string representation suitable for GLSL shaders with integer components
Gets the w component (always 1 for 3D vectors).
Always returns 1
Gets the WGSL representation of this vector as a float vec3f.
A string representation suitable for WGSL shaders
Gets the WGSL representation of this vector as an integer vec3i.
A string representation suitable for WGSL shaders with integer components
Gets the x component of the vector.
The x component value
Sets the x component of the vector.
The new x value
Gets the y component of the vector.
The y component value
Sets the y component of the vector.
The new y value
Gets the z component of the vector.
The z component value
Sets the z component of the vector.
The new z value
Static
compositionGets the composition type for this vector class.
The composition type (Vec3)
Adds another vector to this vector. Performs component-wise addition and modifies this vector in place.
The vector to add
This vector instance for method chaining
Creates a copy of this vector with double precision.
A new vector instance with the same values
Copies the components from another vector.
The vector to copy from
This vector instance for method chaining
Computes the cross product of this vector with another vector. Calculates the cross product and modifies this vector in place to store the result. The cross product produces a vector perpendicular to both input vectors.
The vector to compute cross product with
This vector instance for method chaining
Divides this vector by a scalar value. Scales all components by 1/value and modifies this vector in place. If value is 0, sets all components to Infinity and logs an error.
The scalar value to divide by
This vector instance for method chaining
Divides this vector by another vector component-wise. Performs element-wise division and modifies this vector in place. If any component of the divisor vector is 0, sets the corresponding component to Infinity.
The vector to divide by
This vector instance for method chaining
Calculates the dot product of this vector with another vector.
The vector to calculate dot product with
The dot product result
Checks if this vector is approximately equal to another vector within a tolerance.
The vector to compare with
The tolerance for comparison (default: Number.EPSILON)
True if vectors are approximately equal, false otherwise
Checks if this vector is strictly equal to another vector (exact comparison).
The vector to compare with
True if vectors are exactly equal, false otherwise
Checks if the internal storage shares the same ArrayBuffer as the provided one. Useful for determining if vectors share underlying memory.
The ArrayBuffer to compare against
True if the same ArrayBuffer is used, false otherwise
Calculates the distance from this vector to another vector.
The target vector
The distance between the vectors
Multiplies this vector by a scalar value. Scales all components by the given value and modifies this vector in place.
The scalar value to multiply by
This vector instance for method chaining
Applies a quaternion rotation to this vector. Rotates this vector by the given quaternion and modifies it in place. Equivalent to: quat * vector3 * quat^(-1)
The quaternion representing the rotation
This vector instance for method chaining
Multiplies this vector by another vector component-wise. Performs element-wise multiplication and modifies this vector in place.
The vector to multiply by
This vector instance for method chaining
Normalizes this vector to unit length. Modifies the vector in place to have a magnitude of 1.
This vector instance for method chaining
Sets all components to one.
This vector instance for method chaining
Returns the raw typed array containing the vector components.
The underlying typed array
Sets the value at the specified index.
The index (0 for x, 1 for y, 2 for z)
The new value to set
This vector instance for method chaining
Sets all three components of the vector.
The x component value
The y component value
The z component value
This vector instance for method chaining
Subtracts another vector from this vector. Performs component-wise subtraction and modifies this vector in place.
The vector to subtract
This vector instance for method chaining
Sets all components to zero.
This vector instance for method chaining
Static
_addAdds two vectors component-wise (static version).
The first vector
The second vector
The typed array constructor to use
A new vector containing the sum
Static
_crossCalculates the cross product of two vectors (static version).
The first vector (left operand)
The second vector (right operand)
The typed array constructor to use
A new vector containing the cross product result
Static
_divideDivides a vector by a scalar value (static version).
The vector to divide
The scalar value to divide by
The typed array constructor to use
A new vector containing the divided result
Static
_divideDivides two vectors component-wise (static version).
The vector to divide
The vector to divide by
The typed array constructor to use
A new vector containing the component-wise division result
Static
_dummyCreates an empty dummy vector for placeholder purposes.
The typed array constructor to use
A new dummy vector
Protected
Static
_fromProtected
Creates a new vector from three component values.
The x component
The y component
The z component
The typed array constructor
A new vector instance
Static
_fromCreates a vector from an array (takes first 3 elements).
The array containing the components
The typed array constructor to use
A new vector
Static
_fromCreates a vector from a 3-element array.
The array containing x, y, z components
The typed array constructor to use
A new vector
Static
_fromCreates a vector by copying from another Vector3.
The source vector to copy from
The typed array constructor to use
A new vector
Static
_fromCreates a Vector3 from a Vector4 (drops the w component).
The source Vector4 to copy from
The typed array constructor to use
A new vector
Static
_fromCreates a Vector3 from a Vector2 (sets z component to 0).
The source Vector2 to copy from
The typed array constructor to use
A new vector
Static
_lerpPerforms linear interpolation between two vectors (static version).
The start vector
The end vector
The interpolation ratio (0.0 to 1.0)
The typed array constructor to use
A new vector containing the interpolated result
Static
_multiplyMultiplies a vector by a scalar value (static version).
The vector to multiply
The scalar value to multiply by
The typed array constructor to use
A new vector containing the scaled result
Static
_multiplyTransforms a 3D vector by a 4x4 matrix, treating the vector as a point (w=1). The result is perspective-divided if the w component is not 1.
The vector to transform
The 4x4 transformation matrix
The typed array constructor to use
A new transformed vector
Static
_multiplyTransforms a vector by a quaternion rotation (static version). This applies the quaternion rotation to the vector.
The quaternion to apply
The vector to transform
The typed array constructor to use
A new vector containing the transformed result
Static
_multiplyMultiplies two vectors component-wise (static version).
The first vector
The second vector
The typed array constructor to use
A new vector containing the component-wise product
Static
_normalizeNormalizes a vector to unit length (static version).
The vector to normalize
The typed array constructor to use
A new normalized vector
Static
_oneCreates a vector with all components set to 1 (1, 1, 1).
The typed array constructor to use
A new vector with all components set to 1
Static
_subtractSubtracts the second vector from the first vector (static version).
The vector to subtract from
The vector to subtract
The typed array constructor to use
A new vector containing the difference
Static
_zeroCreates a zero vector (0, 0, 0).
The typed array constructor to use
A new zero vector
Static
addCreates a new vector that is the sum of two vectors with double precision.
A new vector containing the sum
Static
addAdds two vectors and stores the result in the output vector.
The first vector
The second vector
The output vector to store the result
The output vector containing the sum
Static
angleStatic
crossCreates a new vector that is the cross product of two vectors with double precision.
A new vector containing the cross product
Static
crossCalculates the cross product of two vectors and stores the result in the output vector.
The first vector (left operand)
The second vector (right operand)
The output vector to store the result
The output vector containing the cross product result
Static
divideCreates a new vector that is the scalar division of a vector with double precision.
The vector to divide
The scalar divisor
A new divided vector
Static
divideDivides a vector by a scalar and stores the result in the output vector.
The vector to divide
The scalar value to divide by
The output vector to store the result
The output vector containing the divided result
Static
divideCreates a new vector that is the component-wise division of two vectors with double precision.
A new vector containing the component-wise quotient
Static
divideDivides two vectors component-wise and stores the result in the output vector.
The vector to divide
The vector to divide by
The output vector to store the result
The output vector containing the component-wise division result
Static
dotStatic
dummyCreates a dummy vector for initialization purposes with double precision.
A new dummy vector
Static
fromCreates a vector with all components set to the same value with double precision.
The value for all components
A new vector instance
Static
fromCreates a vector from three component values with double precision.
The x component
The y component
The z component
A new vector instance
Static
fromCreates a vector from an array, taking the first 3 elements with double precision.
The array containing at least 3 values
A new vector instance
Static
fromCreates a vector from a 3-element array with double precision.
The array containing x, y, z values
A new vector instance
Static
lengthStatic
lengthCalculates the squared length of a vector (static version). This is more efficient than calculating the actual length when only comparison is needed.
The vector to calculate squared length for
The squared length of the vector
Static
multiplyCreates a new vector that is the scalar multiplication of a vector with double precision.
The vector to multiply
The scalar value
A new scaled vector
Static
multiplyCreates a new vector by applying a quaternion rotation to a vector with double precision.
The quaternion representing the rotation
The vector to rotate
A new rotated vector
Static
multiplyTransforms a vector by a quaternion rotation and stores the result in the output vector. This applies the quaternion rotation to the vector.
The quaternion to apply
The vector to transform
The output vector to store the result
The output vector containing the transformed result
Static
multiplyMultiplies a vector by a scalar and stores the result in the output vector.
The vector to multiply
The scalar value to multiply by
The output vector to store the result
The output vector containing the scaled result
Static
multiplyCreates a new vector that is the component-wise multiplication of two vectors with double precision.
A new vector containing the component-wise product
Static
multiplyMultiplies two vectors component-wise and stores the result in the output vector.
The first vector
The second vector
The output vector to store the result
The output vector containing the component-wise product
Static
normalizeCreates a normalized copy of the given vector with double precision.
The vector to normalize
A new normalized vector
Static
normalizeNormalizes a vector and stores the result in the output vector.
The vector to normalize
The output vector to store the result
The output vector containing the normalized result
Static
oneCreates a unit vector (1, 1, 1) with double precision.
A new unit vector
Static
rotateXRotates a vector around the X-axis and stores the result in the output vector with double precision. Only the Y and Z components are affected by X-axis rotation.
The input vector to rotate
The rotation angle in radians
The output vector to store the result
Static
rotateYRotates a vector around the Y-axis and stores the result in the output vector with double precision. Only the X and Z components are affected by Y-axis rotation.
The input vector to rotate
The rotation angle in radians
The output vector to store the result
Static
rotateZRotates a vector around the Z-axis and stores the result in the output vector with double precision. Only the X and Y components are affected by Z-axis rotation.
The input vector to rotate
The rotation angle in radians
The output vector to store the result
Static
subtractCreates a new vector that is the difference of two vectors with double precision.
A new vector containing the difference
Static
subtractSubtracts two vectors and stores the result in the output vector.
The vector to subtract from
The vector to subtract
The output vector to store the result
The output vector containing the difference
Static
zeroCreates a zero vector (0, 0, 0) with double precision.
A new zero vector
Mutable 3D vector class with 64-bit double precision. Provides higher precision vector operations for applications requiring greater numerical accuracy than 32-bit floats.