Struct trackball::Orbit [−][src]
pub struct Orbit<N: RealField> { /* fields omitted */ }
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
impl<N: RealField> Orbit<N>
[src]
pub fn compute(
&mut self,
pos: &Point2<N>,
max: &Point2<N>
) -> Option<UnitQuaternion<N>>
[src]
&mut self,
pos: &Point2<N>,
max: &Point2<N>
) -> Option<UnitQuaternion<N>>
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.
pub fn discard(&mut self)
[src]
Discards cached normalization of previous cursor/finger position on button/finger release.
Trait Implementations
impl<N: Clone + RealField> Clone for Orbit<N>
[src]
impl<N: Debug + RealField> Debug for Orbit<N>
[src]
impl<N: Default + RealField> Default for Orbit<N>
[src]
Auto Trait Implementations
impl<N> RefUnwindSafe for Orbit<N> where
N: RefUnwindSafe,
N: RefUnwindSafe,
impl<N> Send for Orbit<N>
impl<N> Sync for Orbit<N>
impl<N> Unpin for Orbit<N> where
N: Unpin,
N: Unpin,
impl<N> UnwindSafe for Orbit<N> where
N: UnwindSafe,
N: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn is_in_subset(&self) -> bool
pub fn to_subset_unchecked(&self) -> SS
pub fn from_subset(element: &SS) -> SP
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,