openrndr / org.openrndr.math / map

map

fun map(beforeLeft: Double, beforeRight: Double, afterLeft: Double, afterRight: Double, value: Double, clamp: Boolean = false): Double (source)

Linearly maps a value, which is given in the before domain to a value in the after domain

Parameters

beforeLeft - the left value of the before domain

beforeRight - the right value of the before domain

afterLeft - the left value of the after domain

afterRight - the right value of the after domain

value - the value to map from the before domain to the after domain

clamp - constrain the result to afterLeft,afterRight

Return
a value in the after domain

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