#[non_exhaustive]pub struct View {
pub frame: Frame3,
pub near: Option<f64>,
pub far: Option<f64>,
pub projection: ViewProjection,
}Expand description
A view: orthographic by default, or perspective (see ViewProjection).
For a model point p the view coordinates are ((p - o)·x, (p - o)·y)
and the depth W = (p - o)·z, where o, x, y, z are the frame’s
origin and axes. The viewer sits on the +z side and looks along -z, so
a larger W is nearer. An orthographic view’s image is the view
coordinates; a perspective view’s is described at
ViewProjection::Perspective. Geometry is kept where far <= W <= near
(both closed); an absent bound is no bound, except that a perspective view
has a near below zero.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.frame: Frame3Right-handed orthonormal view frame.
near: Option<f64>Nearest kept depth.
far: Option<f64>Farthest kept depth.
projection: ViewProjectionHow points are projected to the image.
Implementations§
Source§impl View
impl View
Sourcepub fn perspective(frame: Frame3, near: f64) -> Result<Self, HiddenLineError>
pub fn perspective(frame: Frame3, near: f64) -> Result<Self, HiddenLineError>
A perspective view from the eye at frame.origin, keeping depths
W <= near. near must be finite and below zero; anything else is
refused, since the central projection is undefined at and behind the
eye.