openrndr / org.openrndr.math.transforms

Package org.openrndr.math.transforms

code related to math transformations

Types

TransformBuilder

class TransformBuilder

Functions

frustum

fun frustum(left: Double, right: Double, bottom: Double, top: Double, zNear: Double, zFar: Double): Matrix44

Creates frustum matrix with the given bounds

lookAt

fun lookAt(eye: Vector3, target: Vector3, up: Vector3 = Vector3.UNIT_Y): Matrix44

Create a view matrix from a camera at position eye look at target

normalMatrix

fun normalMatrix(view: Matrix44): Matrix44

Construct a normal matrix from the give view matrix

ortho

fun ortho(xMag: Double, yMag: Double, zNear: Double, zFar: Double): Matrix44

Creates an orthographic projection matrix

fun ortho(left: Double, right: Double, bottom: Double, top: Double, zNear: Double, zFar: Double): Matrix44

Creates an orthographic projection matrix with the given bounds

perspective

fun perspective(fovY: Double, aspectRatio: Double, zNear: Double, zFar: Double): Matrix44

Creates an perspective projection matrix

fun perspective(fovY: Double, aspectRatio: Double, zNear: Double): Matrix44

Creates an perspective projection matrix with infinite clipping depth

fun perspective(fovY: Double, aspectRatio: Double, zNear: Double, zFar: Double, xOffset: Double, yOffset: Double): Matrix44

Creates an perspective projection matrix with a shifted apex

perspectiveHorizontal

fun perspectiveHorizontal(fovY: Double, aspectRatio: Double, zNear: Double, zFar: Double, xOffset: Double, yOffset: Double): Matrix44

Creates an perspective projection matrix locking the horizontal view angle

project

fun project(point: Vector3, projection: Matrix44, view: Matrix44, width: Int, height: Int): Vector3

Project a 3D point on a 2D surface

rotate

fun rotate(axis: Vector3, angle: Double): Matrix44

Create a rotation matrix around the given axes

rotateX

fun rotateX(angle: Double): Matrix44

Create a rotation matrix around the X axes

rotateY

fun rotateY(angle: Double): Matrix44

Create a rotation matrix around the Y axes

rotateZ

fun rotateZ(angle: Double): Matrix44

Create a rotation matrix around the Z axes

scale

fun scale(scale: Vector3): Matrix44

Create a scaling matrix with the given vector

fun scale(x: Double, y: Double, z: Double): Matrix44

Create a scaling matrix with the given components

transform

fun transform(builder: TransformBuilder.() -> Unit): Matrix44

translate

fun translate(translation: Vector3): Matrix44

Create a translate matrix with the given vector

fun translate(x: Double, y: Double, z: Double): Matrix44

Create a scaling matrix with the given components

unproject

fun unproject(point: Vector3, projection: Matrix44, view: Matrix44, width: Int, height: Int): Vector3