pub struct Orbit<N: Copy + RealField> { /* private fields */ }
Expand description
Orbit induced by displacement on screen.
Implements Default
and can be created with Orbit::default()
.
Both its methods must be invoked on matching events fired by your 3D graphics library of choice.
Implementations§
Source§impl Orbit<f32>
impl Orbit<f32>
Sourcepub fn compute(
&mut self,
pos: &Point2<f32>,
max: &Point2<f32>,
) -> Option<UnitQuaternion<f32>>
Available on crate feature cc
only.
pub fn compute( &mut self, pos: &Point2<f32>, max: &Point2<f32>, ) -> Option<UnitQuaternion<f32>>
cc
only.Computes rotation between previous and current cursor/finger position.
Normalization of previous position is cached and has to be discarded on button/finger
release via Self::discard()
. Current position pos
is clamped between origin and
maximum position max
as screen’s width and height.
Screen space with origin in top left corner:
- x-axis from left to right,
- y-axis from top to bottom.
Camera space with origin at its target, the trackball’s center:
- x-axis from left to right,
- y-axis from bottom to top,
- z-axis from far to near.
Returns None
:
- on first invocation and after
Self::discard()
as there is no previous position yet, - in the unlikely case that a position event fires twice resulting in zero displacements.
Source§impl Orbit<f64>
impl Orbit<f64>
Sourcepub fn compute(
&mut self,
pos: &Point2<f64>,
max: &Point2<f64>,
) -> Option<UnitQuaternion<f64>>
Available on crate feature cc
only.
pub fn compute( &mut self, pos: &Point2<f64>, max: &Point2<f64>, ) -> Option<UnitQuaternion<f64>>
cc
only.Computes rotation between previous and current cursor/finger position.
Normalization of previous position is cached and has to be discarded on button/finger
release via Self::discard()
. Current position pos
is clamped between origin and
maximum position max
as screen’s width and height.
Screen space with origin in top left corner:
- x-axis from left to right,
- y-axis from top to bottom.
Camera space with origin at its target, the trackball’s center:
- x-axis from left to right,
- y-axis from bottom to top,
- z-axis from far to near.
Returns None
:
- on first invocation and after
Self::discard()
as there is no previous position yet, - in the unlikely case that a position event fires twice resulting in zero displacements.
Trait Implementations§
Auto Trait Implementations§
impl<N> Freeze for Orbit<N>where
N: Freeze,
impl<N> RefUnwindSafe for Orbit<N>where
N: RefUnwindSafe,
impl<N> Send for Orbit<N>
impl<N> Sync for Orbit<N>
impl<N> Unpin for Orbit<N>where
N: Unpin,
impl<N> UnwindSafe for Orbit<N>where
N: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.