openrndr / org.openrndr.math / Vector4

# Vector4

`data class Vector4 : Serializable, LinearType<Vector4>` (source)

Double precision vector 4

### Constructors

#### <init>

`Vector4(x: Double)`

Double precision vector 4

`Vector4(x: Double, y: Double, z: Double, w: Double)`

### Properties

#### div

calculate Vector3 by dividing x, y, z by w

`val div: Vector3`

#### length

the Euclidean length of the vector

`val length: Double`

#### normalized

`val normalized: Vector4`

#### squaredLength

the squared Euclidean length of the vector

`val squaredLength: Double`

#### w

`val w: Double`

#### x

`val x: Double`

#### xy

`val xy: Vector2`

#### xyz

`val xyz: Vector3`

#### xz

`val xz: Vector2`

#### y

`val y: Double`

#### yx

`val yx: Vector2`

#### yz

`val yz: Vector2`

#### z

`val z: Double`

#### zx

`val zx: Vector2`

#### zy

`val zy: Vector2`

### Functions

#### distanceTo

calculate the Euclidean distance to other

`fun distanceTo(other: Vector4): Double`

#### div

`operator fun div(v: Vector4): Vector4`
`operator fun div(s: Double): Vector4`

#### get

`operator fun get(i: Int): Double`

#### minus

`operator fun minus(v: Vector4): Vector4`
`operator fun minus(d: Double): Vector4`

#### mix

`fun mix(o: Vector4, mix: Double): Vector4`

#### plus

`operator fun plus(v: Vector4): Vector4`
`operator fun plus(d: Double): Vector4`

#### squaredDistanceTo

calculate the squared Euclidean distance to other

`fun squaredDistanceTo(other: Vector4): Double`

#### times

`operator fun times(v: Vector4): Vector4`
`operator fun times(s: Double): Vector4`

#### toDoubleArray

convert to DoubleArray

`fun toDoubleArray(): DoubleArray`

#### toInt

convert to IntVector4

`fun toInt(): IntVector4`

#### unaryMinus

`operator fun unaryMinus(): Vector4`

### Companion Object Properties

#### ONE

`val ONE: Vector4`

#### UNIT_W

`val UNIT_W: Vector4`

#### UNIT_X

`val UNIT_X: Vector4`

#### UNIT_Y

`val UNIT_Y: Vector4`

#### UNIT_Z

`val UNIT_Z: Vector4`

#### ZERO

`val ZERO: Vector4`

### Extension Functions

#### clamp

`fun Vector4.clamp(min: Vector4, max: Vector4): Vector4`

#### map

`fun Vector4.map(beforeLeft: Vector4, beforeRight: Vector4, afterLeft: Vector4, afterRight: Vector4, clamp: Boolean = false): Vector4`

#### mod

`fun Vector4.mod(b: Vector4): Vector4`

#### saturate

`fun Vector4.saturate(): Vector4`

#### smoothstep

`fun Vector4.smoothstep(edge0: Vector4, edge1: Vector4): Vector4`