Skip to main content

Module vector

Module vector 

Source
Expand description

Vector arithmetic that no single domain owns.

An orthonormal basis about a direction is needed to sample a hemisphere, to orient a scatter lobe and to build a local frame for a contact normal. Reflection about a plane is a light ray off a mirror and a ball off a wall, in the same three lines. Neither belongs to optics, so neither lives there.

Refraction does belong to optics — Snell’s law is about refractive indices — and is in dualis-optics accordingly.

Functions§

basis_for
Two unit vectors completing an orthonormal frame with dir.
oriented_against
Flip n so it opposes the incident direction (d · n < 0).
reflect
Mirror d about the plane with normal n. Both should be normalised.