Expand description
Small vector and matrix helpers for the 3D viewer and the thumbnail
renderer. Vectors are [f32; 3]; matrices are column-major [[f32; 4]; 4]
(m[column][row]), as WGSL reads them. The camera space is right-handed
(the camera looks down −Z) and clip depth runs from 0 (near) to 1 (far),
as wgpu expects.
Functions§
- add
- cross
- dot
- length
- look_at
- The view matrix of a camera at
eyelooking atcenterwithuppointing up the screen. - mul
- normalize
ascaled to length 1; the zero vector stays zero.- orthographic
- An orthographic projection showing
half_hunits above and below the centre of the screen. - perspective
- A perspective projection:
fovyis the vertical field of view in radians,aspectwidth over height. - rotate_
about pturned byangleradians about the axis throughoriginalong the unit vectoraxis, counter-clockwise looking down the axis (Rodrigues).- scale
- sub
- transform_
point mapplied to the pointp, after the divide by w.