dot(a: any, b: any) → number
| arg | type | description |
|---|
| a | any | |
| b | any | |
sub(a: any, b: any) → any
| arg | type | description |
|---|
| a | any | |
| b | any | |
closestAxisParam(ro: any, rd: any, ao: any, ad: any) → number
Parameter `s` along axis (ao + s*ad) at the point closest to the ray
(ro + t*rd). `rd` and `ad` need not be unit length. Returns 0 for a
degenerate (parallel) configuration.
| arg | type | description |
|---|
| ro | any | |
| rd | any | |
| ao | any | |
| ad | any | |
rayPlane(ro: any, rd: any, planePoint: any, n: any) → any
Intersection point of ray (ro + t*rd, t>=0) with the plane through
`planePoint` with normal `n`. Returns nil if parallel or behind the origin.
| arg | type | description |
|---|
| ro | any | |
| rd | any | |
| planePoint | any | |
| n | any | |
snap(v: number, inc: number) → number
Quantize `v` to the nearest multiple of `inc`. `inc <= 0` returns `v`.
| arg | type | description |
|---|
| v | number | |
| inc | number | |
worldPerPixel(dist: number, fovY: number, viewportH: number) → number
World units spanned by one screen pixel at `dist` from the camera, for a
vertical FOV `fovY` (radians) and viewport height `viewportH` px. Used to keep
handles a roughly constant on-screen size: handleLen = pixels * worldPerPixel.
| arg | type | description |
|---|
| dist | number | |
| fovY | number | |
| viewportH | number | |
rotateAround(point: any, pivot: any, axis: any, angle: number) → any
Rotate `point` around `pivot` by `angle` (radians) about unit-ish `axis`
(normalized internally). Right-handed. Returns the new { x, y, z }.
| arg | type | description |
|---|
| point | any | |
| pivot | any | |
| axis | any | |
| angle | number | |
scaleAround(point: any, pivot: any, factors: any) → any
Scale `point`'s offset from `pivot` component-wise by `factors`.
| arg | type | description |
|---|
| point | any | |
| pivot | any | |
| factors | any | |
axisAngleQuat(axis: any, angle: number) → any
Unit quaternion { x, y, z, w } for a rotation of `angle` radians about
`axis` (normalized internally). A degenerate axis yields identity.
| arg | type | description |
|---|
| axis | any | |
| angle | number | |
rotateVec(q: any, vec: any) → any
`vec` rotated by unit quaternion `q` ({ x, y, z, w }): the rotated-basis
expansion of `q v q⁻¹`, so a frame's unit axes carried through an entity's
world rotation come out as that entity's own axes.
| arg | type | description |
|---|
| q | any | |
| vec | any | |
quatMul(a: any, b: any) → any
Hamilton product `a * b` (apply `b` first, then `a`). Composing a
world-space delta rotation `d` onto a start rotation `q0` is
`quatMul(d, q0)`.
| arg | type | description |
|---|
| a | any | |
| b | any | |
projectOntoPlane(vec: any, n: any) → any
Component of `vec` (a world offset) that lies within the plane whose unit
normal is `n`: `vec - (vec·n) n`. Used to keep a planar drag on its plane.
| arg | type | description |
|---|
| vec | any | |
| n | any | |