Vec3

data class Vec3(val x: Double, val y: Double, val z: Double) : Spatial, Distanceable<Vec3> (source)

Constructors

Link copied to clipboard
constructor(vector: Vec3)

Creates a new vector by copying the coordinates from another vector.

constructor(x: Double, y: Double, z: Double)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val x: Double
Link copied to clipboard
val y: Double
Link copied to clipboard
val z: Double

Functions

Link copied to clipboard
fun angle(other: Vec3, angleUnit: AngleUnit): Double
Link copied to clipboard
infix fun cross(other: Vec3): Vec3

Calculates the cross product of this vector with another vector.

Link copied to clipboard
open override fun dimensions(): Int

Returns the number of dimensions of the spatial object.

Link copied to clipboard
open infix override fun distance(other: Vec3): Double

Compute the distance to another point.

Link copied to clipboard
infix fun dot(other: Vec3): Double

Calculates the dot product of this vector with another vector.

Link copied to clipboard
fun eq(other: Vec3, equivalence: DoubleEquivalence = DEFAULT_DOUBLE_EQUIVALENCE): Boolean

Checks if two vectors are equal within a specified tolerance.

Link copied to clipboard
open override fun isFinite(): Boolean

Returns true if all values in the spatial are finite.

Link copied to clipboard
open override fun isInfinite(): Boolean

Returns true if any value in the spatial is infinite.

Link copied to clipboard
open override fun isNaN(): Boolean

Returns true if any value in the spatial is NaN (Not a Number).

Link copied to clipboard
fun lerp(other: Vec3, t: Double): Vec3

Performs linear interpolation between this vector and another vector.

Link copied to clipboard
operator fun minus(other: Vec3): Vec3

Returns the number of dimensions of the vector.

Link copied to clipboard
fun norm(): Double

Calculates the Euclidean norm (magnitude) of the vector.

Link copied to clipboard

Normalizes the vector to a unit vector.

Link copied to clipboard
operator fun plus(other: Vec3): Vec3

Adds two vectors component-wise.

Link copied to clipboard
fun project(base: Vec3): Vec3

Calculate the projection of this vector onto another vector.

Link copied to clipboard
fun reject(base: Vec3): Vec3

Calculates the rejection of this vector from another vector.

Link copied to clipboard
operator fun times(scalar: Double): Vec3

Multiplies this vector by a scalar.

Link copied to clipboard
operator fun unaryMinus(): Vec3

Negates the vector, i.e., multiplies each component by -1.