Represents a 3-dimensional vector with x, y, and z components in meters. Provides common vector operations and geometric transformations. All operations are immutable and return new instances.
Value parameters
- x
-
The x-component (in meters).
- y
-
The y-component (in meters).
- z
-
The z-component (in meters).
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Members list
Value members
Concrete methods
Multiplies the vector by a scalar.
Multiplies the vector by a scalar.
Value parameters
- scalar
-
The scalar value.
Attributes
- Returns
-
The scaled vector.
Adds two vectors.
Adds two vectors.
Value parameters
- other
-
The other vector.
Attributes
- Returns
-
The sum vector.
Subtracts another vector from this vector.
Subtracts another vector from this vector.
Value parameters
- other
-
The other vector.
Attributes
- Returns
-
The difference vector.
Divides the vector by a scalar.
Divides the vector by a scalar.
Value parameters
- scalar
-
The scalar value.
Attributes
- Returns
-
The scaled vector.
Computes the cross product of two vectors.
Computes the cross product of two vectors.
Value parameters
- other
-
The other vector.
Attributes
- Returns
-
The cross product vector.
Calculates the angle between this vector and another. Formula: acos(dotProduct / (magnitude1 * magnitude2))
Calculates the angle between this vector and another. Formula: acos(dotProduct / (magnitude1 * magnitude2))
Type parameters
- T
-
The type of AngleUnit.
Value parameters
- factory
-
Factory function to create an AngleUnit from a Double.
- second
-
The other vector.
Attributes
- Returns
-
The angle as an AngleUnit.
Calculates the Euclidean distance to another vector. Formula: sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2)
Calculates the Euclidean distance to another vector. Formula: sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2)
Type parameters
- T
-
The type of DistanceUnit.
Value parameters
- factory
-
Factory function to create a DistanceUnit from a Double.
- second
-
The other vector.
Attributes
- Returns
-
The distance as a DistanceUnit.
Computes the dot product of two vectors.
Computes the dot product of two vectors.
Value parameters
- other
-
The other vector.
Attributes
- Returns
-
The dot product.
Computes the Euclidean magnitude (length) of the vector in meters. Formula: sqrt(x^2 + y^2 + z^2)
Computes the Euclidean magnitude (length) of the vector in meters. Formula: sqrt(x^2 + y^2 + z^2)
Attributes
- Returns
-
The magnitude in meters, or 0.0 if NaN or infinite.
Returns a vector with all components negated.
Returns a vector with all components negated.
Attributes
- Returns
-
The negated vector.
Returns the normalized (unit length) vector. If magnitude is zero, returns the original vector.
Returns the normalized (unit length) vector. If magnitude is zero, returns the original vector.
Attributes
- Returns
-
The normalized vector.
Rotates the vector around the X axis by the given angle.
Rotates the vector around the X axis by the given angle.
Value parameters
- angle
-
The angle to rotate by.
Attributes
- Returns
-
The rotated vector.
Rotates the vector around the Y axis by the given angle.
Rotates the vector around the Y axis by the given angle.
Value parameters
- angle
-
The angle to rotate by.
Attributes
- Returns
-
The rotated vector.
Rotates the vector around the Z axis by the given angle.
Rotates the vector around the Z axis by the given angle.
Value parameters
- angle
-
The angle to rotate by.
Attributes
- Returns
-
The rotated vector.
Returns a string representation of the vector.
Returns a string representation of the vector.
Attributes
- Returns
-
String in the format Vector3D(x, y, z)
- Definition Classes
-
Any
Checks if two vectors are approximately equal within a given epsilon.
Checks if two vectors are approximately equal within a given epsilon.
Value parameters
- epsilon
-
The tolerance.
- other
-
The other vector.
Attributes
- Returns
-
True if all components are within epsilon, false otherwise.
Inherited methods
Attributes
- Inherited from:
- Product
Attributes
- Inherited from:
- Product