Skip to content
Select language:English

MCL 1.3.5

class Vec4d(x: Double, y: Double, z: Double, w: Double) : Vecd

Represents a 4D vector of floating-point double precision coordinates.

Parameters

x

X component.

y

Y component.

z

Z component.

w

W component.

Constructors

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

Types

Properties

Returns the magnitude (norm) of the vector.

Returns the squared magnitude of the vector.

Returns a normalized copy of the vector.

val size: Int

Returns the size of the vector.

val w: Double

W component.

val x: Double

X component.

val y: Double

Y component.

val z: Double

Z component.

Functions

infix fun dot(o: Vec4d): Double

Computes the dot product of two vectors.

operator fun get(i: Int): Double

Returns the value at the specified index.

operator fun minus(o: Vec4d): Vec4d

Subtracts one vector from another.

operator fun plus(o: Vec4d): Vec4d

Adds two vectors.

operator fun times(s: Double): Vec4d

Multiplies a vector by a scalar.

fun toFloat(): Vec4f

Converts this vector to a Vec4f object.

open override fun toString(): String

Returns a JSON-like string representation of the vector with components formatted to three decimal digits.

fun toVec3d(): Vec3d

Converts this vector to a Vec3d object.