openrndr / org.openrndr.math / Vector2

Vector2

data class Vector2 : Serializable (source)

Double precision vector 2

Constructors

<init>

Vector2(x: Double)

Double precision vector 2

Vector2(x: Double, y: Double)

Properties

length

val length: Double

normalized

val normalized: Vector2

squaredLength

val squaredLength: Double

x

val x: Double

xx

val xx: Vector2

xy0

val xy0: Vector3

xy01

val xy01: Vector4

y

val y: Double

yx

val yx: Vector2

yy

val yy: Vector2

Functions

distanceTo

fun distanceTo(o: Vector2): Double

div

operator fun div(d: Double): Vector2
operator fun div(d: Vector2): Vector2

dot

infix fun dot(right: Vector2): Double

get

operator fun get(i: Int): Double

invoke

operator fun invoke(x: Double = this.x, y: Double = this.y): Vector2

minus

operator fun minus(vector2: Vector2): Vector2
operator fun minus(d: Double): Vector2

mix

fun mix(o: Vector2, mix: Double): Vector2

perpendicular

fun perpendicular(polarity: YPolarity = YPolarity.CW_NEGATIVE_Y): Vector2

plus

operator fun plus(vector2: Vector2): Vector2
operator fun plus(d: Double): Vector2

reflect

infix fun reflect(surfaceNormal: Vector2): Vector2

squaredDistanceTo

fun squaredDistanceTo(o: Vector2): Double

times

operator fun times(d: Double): Vector2
operator fun times(v: Vector2): Vector2

unaryMinus

operator fun unaryMinus(): Vector2

vector3

fun vector3(x: Double = this.x, y: Double = this.y, z: Double = 0.0): Vector3

Companion Object Properties

INFINITY

val INFINITY: Vector2

ONE

val ONE: Vector2

UNIT_X

val UNIT_X: Vector2

UNIT_Y

val UNIT_Y: Vector2

ZERO

val ZERO: Vector2

Companion Object Functions

fromPolar

fun fromPolar(polar: Polar): Vector2

Extension Functions

clamp

fun Vector2.clamp(min: Vector2, max: Vector2): Vector2

map

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

mod

fun Vector2.mod(b: Vector2): Vector2

saturate

fun Vector2.saturate(): Vector2

smoothstep

fun Vector2.smoothstep(edge0: Vector2, edge1: Vector2): Vector2