Vector3D

org.abh80.nf.core.math.Vector3D
See theVector3D companion object
final case class Vector3D(x: Double, y: Double, z: Double)

Represents a 3-dimensional vector with x, y, and z components. Provides common vector operations and geometric transformations.

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 Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def *(scalar: Double): Vector3D
Implicitly added by BinOp

Multiplies the vector by a scalar.

Multiplies the vector by a scalar.

Value parameters

scalar

The scalar value.

Attributes

Returns

The scaled vector.

def +(other: Vector3D): Vector3D
Implicitly added by BinOp

Adds two vectors.

Adds two vectors.

Value parameters

other

The other vector.

Attributes

Returns

The sum vector.

def -(other: Vector3D): Vector3D
Implicitly added by BinOp

Subtracts another vector from this vector.

Subtracts another vector from this vector.

Value parameters

other

The other vector.

Attributes

Returns

The difference vector.

def /(scalar: Double): Vector3D
Implicitly added by BinOp

Divides the vector by a scalar.

Divides the vector by a scalar.

Value parameters

scalar

The scalar value.

Attributes

Returns

The scaled vector.

def X(other: Vector3D): Vector3D
Implicitly added by BinOp

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.

def angleTo[T <: AngleUnit](second: Vector3D)(factory: Double => T): T

Calculates the angle between this vector and another.

Calculates the angle between this vector and another.

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.

def distanceTo[T <: DistanceUnit](second: Vector3D)(factory: Double => T): T

Calculates the distance to another vector.

Calculates the distance to another vector.

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.

def dot(other: Vector3D): Double
Implicitly added by BinOp

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.

def magnitude: Double

Computes the magnitude (length) of the vector.

Computes the magnitude (length) of the vector.

Attributes

Returns

The magnitude.

Returns the normalized (unit length) vector.

Returns the normalized (unit length) vector.

Attributes

Returns

The normalized vector.

def rotateX(angle: AngleUnit): Vector3D

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.

def rotateY(angle: AngleUnit): Vector3D

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.

def rotateZ(angle: AngleUnit): Vector3D

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.

override def toString: String

Returns a string representation of the vector.

Returns a string representation of the vector.

Attributes

Returns

String in the format Vector3D(x, y, z) [m]

Definition Classes
Any
def ~(other: Vector3D, epsilon: Double): Boolean
Implicitly added by BinOp

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

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product