Vector4

@Serializable
data class Vector4(    val x: Double,     val y: Double,     val z: Double,     val w: Double) : LinearType<Vector4> , EuclideanVector<Vector4>

Double-precision 4D vector.

Constructors

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

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open fun areaBetween(other: Vector4): Double

returns the area of the parallelogram formed by extruding this over other

Link copied to clipboard
open fun atan2(other: Vector4): Double

atan2 style angle between this and other

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

Calculates the Euclidean distance to other.

Link copied to clipboard
open operator override fun div(scale: Double): Vector4
operator fun div(v: Vector4): Vector4
Link copied to clipboard
open infix override fun dot(right: Vector4): Double

Calculates a dot product between this Vector4 and right.

Link copied to clipboard
operator fun get(i: Int): Double
Link copied to clipboard
open override fun map(function: (Double) -> Double): Vector4

apply function to all components

Link copied to clipboard
operator fun minus(d: Double): Vector4
open operator override fun minus(right: Vector4): Vector4
Link copied to clipboard
fun mix(o: Vector4, mix: Double): Vector4
Link copied to clipboard
operator fun plus(d: Double): Vector4
open operator override fun plus(right: Vector4): Vector4
Link copied to clipboard
open infix fun projectedOn(on: Vector4): Vector4

project this vector on on

Link copied to clipboard
open infix fun reflectedOver(surfaceNormal: Vector4): Vector4

reflect this vector over surfaceNormal

Link copied to clipboard
open override fun squaredDistanceTo(other: Vector4): Double

Calculates the squared Euclidean distance to other.

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

Casts to DoubleArray.

Link copied to clipboard
fun toInt(): IntVector4

Casts to IntVector4.

Link copied to clipboard
operator fun unaryMinus(): Vector4

Properties

Link copied to clipboard
val div: Vector3

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

Link copied to clipboard
open override val length: Double

The Euclidean length of the vector.

Link copied to clipboard
open val normalized: Vector4

normalized vector

Link copied to clipboard
open override val squaredLength: Double

The squared Euclidean length of the vector.

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

Downcasts to Vector3 by discarding w.

Link copied to clipboard
val xz: Vector2
Link copied to clipboard
val y: Double
Link copied to clipboard
val yx: Vector2
Link copied to clipboard
val yz: Vector2
Link copied to clipboard
val z: Double
Link copied to clipboard
open override val zero: Vector4

returns the zero vector

Link copied to clipboard
val zx: Vector2
Link copied to clipboard
val zy: Vector2

Extensions

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.

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

Sources

Link copied to clipboard