Struct trackball::Scene[][src]

pub struct Scene<N: RealField> { /* fields omitted */ }

Scene wrt enclosing viewing frustum.

Implements Default and can be created with Scene::default().

Implementations

impl<N: RealField> Scene<N>[src]

pub fn fov(&self) -> Fixed<N>[src]

Fixed quantity wrt field of view, see Self::set_fov().

pub fn set_fov(&mut self, fov: impl Into<Fixed<N>>)[src]

Sets fixed quantity wrt field of view.

Default is fixed vertical field of view of π/4.

use nalgebra::Point2;
use trackball::Scene;

// Current screen size.
let max = Point2::new(800, 600);
// Default scene with fixed vertical field of view of π/4:
//
//   * Increasing width increases horizontal field of view (more can be seen).
//   * Increasing height scales scene zooming in as vertical field of view is fixed.
let mut scene = Scene::default();
// Unfix vertical field of view by fixing current unit per pixel on focus plane at distance
// from eye of one, that is effectively `upp` divided by `zat` to make it scale-independant:
//
//   * Increasing width increases horizontal field of view (more can be seen).
//   * Increasing height increases vertical field of view (more can be seen).
scene.set_fov(scene.fov().to_upp(&max.cast::<f32>()));

pub fn clip_planes(&self, zat: N) -> (N, N)[src]

Clip plane distances from eye regardless of Self::scale() wrt to distance between eye and target.

Default is (1e-1, 1e+6) measured from eye.

pub fn set_clip_planes(&mut self, znear: N, zfar: N)[src]

Sets clip plane distances from target or eye whether Self::scale().

Default is (1e-1, 1e+6) measured from eye.

pub fn scale(&self) -> bool[src]

Object inspection mode.

Scales clip plane distances by measuring from target instead of eye. Default is false.

pub fn set_scale(&mut self, oim: bool)[src]

Sets object inspection mode.

Scales clip plane distances by measuring from target instead of eye. Default is false.

pub fn ortho(&self) -> bool[src]

Orthographic projection mode.

Computes scale-identical orthographic instead of perspective projection. Default is false.

pub fn set_ortho(&mut self, opm: bool)[src]

Sets orthographic projection mode.

Computes scale-identical orthographic instead of perspective projection. Default is false.

pub fn projection_and_upp(&self, zat: N, max: &Point2<N>) -> (Matrix4<N>, N)[src]

Projection transformation and unit per pixel on focus plane wrt distance between eye and target and maximum position in screen space.

Trait Implementations

impl<N: Clone + RealField> Clone for Scene<N>[src]

fn clone(&self) -> Scene<N>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<N: Debug + RealField> Debug for Scene<N>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<N: RealField> Default for Scene<N>[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

impl<N: PartialEq + RealField> PartialEq<Scene<N>> for Scene<N>[src]

fn eq(&self, other: &Scene<N>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Scene<N>) -> bool[src]

This method tests for !=.

impl<N: Eq + RealField> Eq for Scene<N>[src]

impl<N: RealField> StructuralEq for Scene<N>[src]

impl<N: RealField> StructuralPartialEq for Scene<N>[src]

Auto Trait Implementations

impl<N> RefUnwindSafe for Scene<N> where
    N: RefUnwindSafe

impl<N> Send for Scene<N>

impl<N> Sync for Scene<N>

impl<N> Unpin for Scene<N> where
    N: Unpin

impl<N> UnwindSafe for Scene<N> where
    N: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

pub fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

pub fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).

pub fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

pub fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

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]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.