Builtin Library
README.md
viewpoints
The named camera stations a capture can be taken from, and the rule that decides
what a name like front means.
A viewpoint is a direction with an image-up: where the camera stands relative
to what it is looking at, and which way is up in the resulting picture. Naming
one replaces reverse-engineering a {yaw, pitch} pair, and names the seven
stations that answer "is this built correctly" — the six sides and the corner.
| Viewpoint | Sees |
|---|---|
front | the side the subject faces |
back | the opposite side |
right | the subject's right |
left | the subject's left |
top | plan view, the subject's front toward the top of the image |
bottom | the underside |
iso | the corner view where all three axes project equally |
An entity faces its local -Z, so the camera that sees its front sits on its +Z.
top and bottom take their image-up from the subject's forward axis, because
world up is undefined when you are looking straight down it — that is what puts
the subject's front at the top of a plan view instead of leaving the roll to
whatever the yaw happened to be.
Basis
basis says which axes the name is measured against, and it has no default:
"local"— the subject's own axes.frontis the side the subject faces, whichever way it is turned, and the frame is fitted to the subject's own extents (entity:orientedBounds())."world"— the world axes.frontis the side facing world +Z, whatever the subject is doing.
For a crate turned 40 degrees these are different pictures, so the caller states
which one it wants. A default would mean one call site's front is the crate's
front and another's is the world's, and the difference only shows up in the
image. With no subject to take axes from — a capture framed on a world position
rather than an entity — both values mean the world axes, and both are accepted.
Orthographic size
orthoHeightFor answers the question an orthographic frame asks that a
perspective one does not: how big is the frame? A perspective camera backs off
until the subject fits; an orthographic camera does not converge, so its size is
decided by the subject alone — project the bounds' eight corners onto the
camera's up and right axes and take whichever needs more room.
Its half extents and axes must be stated in the same frame. A resolved
viewpoint carries both: frame axes to use with local-frame extents, and its
world axes to use with world extents.