#[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<View, HiddenLineError>
pub fn perspective(frame: Frame3, near: f64) -> Result<View, 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.
Trait Implementations§
impl Copy for View
impl StructuralPartialEq for View
Auto Trait Implementations§
impl Freeze for View
impl RefUnwindSafe for View
impl Send for View
impl Sync for View
impl Unpin for View
impl UnsafeUnpin for View
impl UnwindSafe for View
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more