Reference · Rockets, variants, parts and the fit check
frameForfunction
The nearest camera that holds the whole of min to max in a picture aspect wide for 1 tall, from angle.
Import it
import { frameFor } from "@johnmorrisdotca/uchusen-rockets";
Definition
function frameFor(min: Vec3, max: Vec3, angle: Angle, aspect: number, margin?: number): Framing
Parameters
| Name | Type | Description |
|---|---|---|
min | Vec3 | The lowest corner of the box to hold. |
max | Vec3 | The highest corner. |
angle | Angle | The angle to look from. |
aspect | number | The picture's width over its height. |
margin (optional) | number | Room left round the box, as a multiple. Defaults to 1.08. |
Returns
Framing
The camera that holds the whole box.
Examples
import { frameFor, VIEWS } from "@johnmorrisdotca/uchusen-rockets";
const framing = frameFor([-4.5, 0, -4.5], [4.5, 124, 4.5], VIEWS.front, 480 / 640);
console.log(framing.target, framing.distance.toFixed(0));[ 0, 62, 0 ] 321What it prints (run when this page was built)