openrndr / org.openrndr.math / Vector3

# Vector3

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

Double precision vector 3

### Constructors

#### <init>

`Vector3(x: Double)`

Double precision vector 3

`Vector3(x: Double, y: Double, z: Double)`

### Properties

#### length

`val length: Double`

#### normalized

`val normalized: Vector3`

#### spherical

`val spherical: Spherical`

#### squaredLength

`val squaredLength: Double`

#### x

`val x: Double`

#### xy

`val xy: Vector2`

#### xyz0

`val xyz0: Vector4`

#### xyz1

`val xyz1: Vector4`

#### xz

`val xz: Vector2`

#### y

`val y: Double`

#### yx

`val yx: Vector2`

#### z

`val z: Double`

#### zx

`val zx: Vector2`

### Functions

#### cross

`infix fun cross(v: Vector3): Vector3`

#### distanceTo

calculate the Euclidean distance to other

`fun distanceTo(other: Vector3): Double`

#### div

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

#### dot

`infix fun dot(v: Vector3): Double`

#### get

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

#### minus

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

#### mix

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

#### plus

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

#### projectedOn

`infix fun projectedOn(v: Vector3): Vector3`

#### reflect

`infix fun reflect(surfaceNormal: Vector3): Vector3`

#### squaredDistanceTo

calculate the squared Euclidean distance to other

`fun squaredDistanceTo(other: Vector3): Double`

#### times

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

#### toDoubleArray

convert to DoubleArray

`fun toDoubleArray(): DoubleArray`

#### toInt

convert to IntVector3

`fun toInt(): IntVector3`

#### unaryMinus

`operator fun unaryMinus(): Vector3`

### Companion Object Properties

#### INFINITY

`val INFINITY: Vector3`

#### ONE

`val ONE: Vector3`

#### UNIT_X

`val UNIT_X: Vector3`

#### UNIT_Y

`val UNIT_Y: Vector3`

#### UNIT_Z

`val UNIT_Z: Vector3`

#### ZERO

`val ZERO: Vector3`

### Companion Object Functions

#### fromSpherical

`fun fromSpherical(s: Spherical): Vector3`

### Extension Functions

#### clamp

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

#### map

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

#### mod

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

#### saturate

`fun Vector3.saturate(): Vector3`

#### smoothstep

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