Orbit

Struct Orbit 

Source
pub struct Orbit {
    pub target: Point3<World>,
    pub dir: SphericalVec<World>,
}
Expand description

Orbiting camera transform.

Keeps the camera centered on a world-space point, and allows free 360°/180° azimuth/altitude rotation around that point as well as setting the distance from the point.

Fields§

§target: Point3<World>

The camera’s target point in world space.

§dir: SphericalVec<World>

The camera’s direction in world space.

Implementations§

Source§

impl Orbit

Source

pub fn rotate(&mut self, az_delta: Angle, alt_delta: Angle)

Adds the azimuth and altitude to the camera’s current direction.

Wraps the resulting azimuth to [-180°, 180°) and clamps the altitude to [-90°, 90°].

Source

pub fn rotate_to(&mut self, az: Angle, alt: Angle)

Rotates the camera to the world-space azimuth and altitude given.

Wraps the azimuth to [-180°, 180°) and clamps the altitude to [-90°, 90°].

Source

pub fn translate(&mut self, delta: Vec3<World>)

Translates the camera’s target point in world space.

Source

pub fn zoom(&mut self, factor: f32)

Moves the camera towards or away from the target.

Multiplies the current camera distance by factor. The distance is clamped to zero. Note that if the distance becomes zero, you cannot use this method to make it nonzero again!

To set an absolute zoom distance, use zoom_to.

§Panics

If factor < 0.

Source

pub fn zoom_to(&mut self, r: f32)

Moves the camera to the given distance from the target.

§Panics

If r < 0.

Trait Implementations§

Source§

impl Clone for Orbit

Source§

fn clone(&self) -> Orbit

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Orbit

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Orbit

Available on crate feature fp only.
Source§

fn default() -> Self

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

impl Transform for Orbit

Available on crate feature fp only.
Source§

fn world_to_view(&self) -> Mat4x4<WorldToView>

Returns the current world-to-view matrix.
Source§

impl Copy for Orbit

Auto Trait Implementations§

§

impl Freeze for Orbit

§

impl RefUnwindSafe for Orbit

§

impl Send for Orbit

§

impl Sync for Orbit

§

impl Unpin for Orbit

§

impl UnwindSafe for Orbit

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.