Vector4

data class Vector4(x: Double, y: Double, z: Double, w: Double) : LinearType<Vector4>

Double-precision 4D vector.

Constructors

Vector4
Link copied to clipboard
fun Vector4(x: Double)
Vector4
Link copied to clipboard
fun Vector4(x: Double, y: Double, z: Double, w: Double)

Types

Companion
Link copied to clipboard
object Companion

Functions

distanceTo
Link copied to clipboard
fun distanceTo(other: Vector4): Double

Calculates the Euclidean distance to other.

div
Link copied to clipboard
open operator override fun div(scale: Double): Vector4
operator fun div(v: Vector4): Vector4
get
Link copied to clipboard
operator fun get(i: Int): Double
minus
Link copied to clipboard
operator fun minus(d: Double): Vector4
open operator override fun minus(right: Vector4): Vector4
mix
Link copied to clipboard
fun mix(o: Vector4, mix: Double): Vector4
plus
Link copied to clipboard
operator fun plus(d: Double): Vector4
open operator override fun plus(right: Vector4): Vector4
squaredDistanceTo
Link copied to clipboard
fun squaredDistanceTo(other: Vector4): Double

Calculates the squared Euclidean distance to other.

times
Link copied to clipboard
open operator override fun times(scale: Double): Vector4
operator fun times(v: Vector4): Vector4
toDoubleArray
Link copied to clipboard
fun toDoubleArray(): DoubleArray

Casts to DoubleArray.

toInt
Link copied to clipboard
fun toInt(): IntVector4

Casts to IntVector4.

unaryMinus
Link copied to clipboard
operator fun unaryMinus(): Vector4

Properties

div
Link copied to clipboard
val div: Vector3

Calculates Vector3 by dividing x, y, z by w.

length
Link copied to clipboard
val length: Double

The Euclidean length of the vector.

normalized
Link copied to clipboard
val normalized: Vector4

Returns a normalized version of the vector. (i.e. unit vector)

squaredLength
Link copied to clipboard
val squaredLength: Double

The squared Euclidean length of the vector.

w
Link copied to clipboard
val w: Double
x
Link copied to clipboard
val x: Double
xy
Link copied to clipboard
val xy: Vector2
xyz
Link copied to clipboard
val xyz: Vector3

Downcasts to Vector3 by discarding w.

xz
Link copied to clipboard
val xz: Vector2
y
Link copied to clipboard
val y: Double
yx
Link copied to clipboard
val yx: Vector2
yz
Link copied to clipboard
val yz: Vector2
z
Link copied to clipboard
val z: Double
zx
Link copied to clipboard
val zx: Vector2
zy
Link copied to clipboard
val zy: Vector2

Extensions

clamp
Link copied to clipboard
fun Vector4.clamp(min: Vector4, max: Vector4): Vector4

Returns Vector4 whose value is limited between min and max per vector component.

map
Link copied to clipboard
fun Vector4.map(beforeLeft: Vector4, beforeRight: Vector4, afterLeft: Vector4, afterRight: Vector4, clamp: Boolean = false): Vector4
mod
Link copied to clipboard
fun Vector4.mod(b: Vector4): Vector4
saturate
Link copied to clipboard
fun Vector4.saturate(): Vector4
smoothstep
Link copied to clipboard
fun Vector4.smoothstep(edge0: Vector4, edge1: Vector4): Vector4