# Vector4

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

Double-precision 4D vector.

## Constructors

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

object Companion

## Functions

open fun areaBetween(other: Vector4): Double

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

open fun atan2(other: Vector4): Double

atan2 style angle between this and other

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

open override fun distanceTo(other: Vector4): Double

Calculates the Euclidean distance to other.

open operator override fun div(scale: Double): Vector4
operator fun div(v: Vector4): Vector4
open infix override fun dot(right: Vector4): Double

Calculates a dot product between this Vector4 and right.

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

apply function to all components

fun Vector4.map(beforeLeft: Vector4, beforeRight: Vector4, afterLeft: Vector4, afterRight: Vector4, clamp: Boolean = false): Vector4
operator fun minus(d: Double): Vector4
open operator override fun minus(right: Vector4): Vector4
fun mix(o: Vector4, mix: Double): Vector4
operator fun plus(d: Double): Vector4
open operator override fun plus(right: Vector4): Vector4
open infix fun projectedOn(on: Vector4): Vector4

project this vector on on

open infix fun reflectedOver(surfaceNormal: Vector4): Vector4

reflect this vector over surfaceNormal

open override fun squaredDistanceTo(other: Vector4): Double

Calculates the squared Euclidean distance to other.

open operator override fun times(scale: Double): Vector4
operator fun times(v: Vector4): Vector4

Casts to IntVector4.

operator fun unaryMinus(): Vector4

## Properties

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

open override val length: Double

The Euclidean length of the vector.

normalized vector

open override val squaredLength: Double

The squared Euclidean length of the vector.

val w: Double
val x: Double
val xy: Vector2

Downcasts to Vector3 by discarding w.

val xz: Vector2
val y: Double
val yx: Vector2