Skip to main content

Module transform

Module transform 

Source
Expand description

Transform factory functions

Every visual operation is a matrix. Compose them via multiplication. M_final = M_last * … * M_first (applied right to left).

Functions§

compose_2d
Compose two 2D transforms: result = a * b (b applied first)
compose_3d
Compose two 3D transforms: result = a * b (b applied first)
ortho
Orthographic projection: maps [l,r]×[b,t]×[n,f] → [-1,1]³
perspective
Perspective projection (fov_y in radians, aspect = width/height)
rotate_2d
2D rotation (counter-clockwise, radians)
rotate_x
Rotation around X axis
rotate_y
Rotation around Y axis
rotate_z
Rotation around Z axis
scale_2d
2D non-uniform scale
scale_2d_uniform
2D uniform scale
scale_3d
3D non-uniform scale
shear_2d
2D shear
translate_2d
2D translation
translate_3d
3D translation
viewport
Screen-space transform: NDC [-1,1]² → pixel [0,w)×[0,h)