Skip to main content

Module math

Module math 

Source
Expand description

Viewport-space coordinate math and conversions.

All math functions in this module are host-neutral and work in terms of normalized or pixel viewport coordinates, without assuming a specific browser or OS window environment.

Structs§

Ray3D
A 3D ray defined by an origin and a normalized direction.
ViewportRect
Host-neutral viewport rectangle in physical or logical pixels.

Functions§

viewport_to_ray
Unprojects a 2D viewport point into a 3D ray for object picking.
viewport_to_world_2d
Transforms a 2D viewport pixel point into 2D world coordinates.
world_to_viewport_2d
Transforms a 2D world point into viewport pixel coordinates.