pub struct Camera {
pub yaw: f64,
pub pitch: f64,
pub distance: f64,
}Expand description
A minimal 3-D view for scenes that spin a model in front of the viewer (CORE-R45).
World axes: x right, y up, z toward the viewer. The model is turned by yaw about
y, then by pitch about x; the eye sits on the +z axis at distance (use
f64::INFINITY, the default, for an orthographic view).
Fields§
§yaw: f64Rotation about the world y axis, radians.
pitch: f64Rotation about the x axis after the yaw, radians.
distance: f64Eye distance from the origin in world units; INFINITY ⇒ orthographic.
Implementations§
Source§impl Camera
impl Camera
Sourcepub fn project(
&self,
p: [f64; 3],
centre: (f64, f64),
scale: f64,
) -> Option<(f64, f64, f64)>
pub fn project( &self, p: [f64; 3], centre: (f64, f64), scale: f64, ) -> Option<(f64, f64, f64)>
Project world point p onto the screen: (x, y) in cell units around
centre (x stretched by ASPECT, y down) with scale rows per world unit,
plus the rotated depth z (larger = nearer, for painter’s sorting and shading).
None for non-finite input or output, and for points at or behind the eye
(z ≥ distance − 1e-9), so callers can let Some(..) else { continue }.