Vector3d
classin packageklyn.math.geometry
public class Vector3d<NUMBER extends AbstractNumber = Double>:
Vector3d

Represents a three-dimensional vector with x, y, and z components.

Example:

direction = Vector3d<Double>(1.0, 2.0, 3.0)
print(direction.magnitude())
Properties
Modifier and Type Member Description
public property x
x as NUMBER
X component.
public propert y
y y as NUMBER
Y component.
public property z
z as NUMBER
Z component.
Constructors
Modifier and Type Member Description
public Vector3d
Vector3d(x as NUMBER, y as NUMBER, z as NUMBER):
Creates a vector from its three components.
Methods
Modifier and Type Member Description
public cross
cross(other as Vector3d<NUMBER>) as Vector3d<NUMBER>:
Computes the cross product with another vector.
public dot
dot(other as Vector3d<NUMBER>) as Double:
Computes the dot product with another vector.
public magnitude
magnitude() as Double:
Computes the Euclidean vector length.
public normalize
normalize() as Vector3d<Double>:
Returns a unit vector with the same direction.
public override toString
toString() as String:
Returns a readable representation of the vector.
Operators
Modifier and Type Member Description
public static operator*(v1 as Vector3d<NUMBER>, scalar as NUMBER) as Vector3d<NUMBER>: Multiplies a vector by a scalar.
public static operator+(v1 as Vector3d<NUMBER>, v2 as Vector3d<NUMBER>) as Vector3d<NUMBER>: Adds two vectors component by component.
public static operator-(v1 as Vector3d<NUMBER>, v2 as Vector3d<NUMBER>) as Vector3d<NUMBER>: Subtracts two vectors component by component.