Rotation

Trait Rotation 

Source
pub trait Rotation<T>:
    Into<Matrix3<T>>
    + From<Matrix3<T>>
    + Into<Axes<T>>
    + From<Axes<T>>
    + Into<Rotor<T>>
    + From<Rotor<T>>
    + Into<Quaternion<T>>
    + From<Quaternion<T>>
where T: One + Zero,
{ const X_AXIS: Vector3<T> = _; const Y_AXIS: Vector3<T> = _; const Z_AXIS: Vector3<T> = _; // Required methods fn look_at_xy(pos: Vector3<T>, look_at: Vector3<T>) -> Self; fn look_at_xz(pos: Vector3<T>, look_at: Vector3<T>) -> Self; fn look_at_yz(pos: Vector3<T>, look_at: Vector3<T>) -> Self; fn look_at_lock( pos: Vector3<T>, look_at: Vector3<T>, locked_axis: Vector3<T>, ) -> Self; fn camera_look_at_xy(pos: Vector3<T>, look_at: Vector3<T>) -> Self; fn camera_look_at_xz(pos: Vector3<T>, look_at: Vector3<T>) -> Self; fn camera_look_at_yz(pos: Vector3<T>, look_at: Vector3<T>) -> Self; fn camera_look_at_lock( pos: Vector3<T>, look_at: Vector3<T>, locked_axis: Vector3<T>, ) -> Self; }

Provided Associated Constants§

Source

const X_AXIS: Vector3<T> = _

Source

const Y_AXIS: Vector3<T> = _

Source

const Z_AXIS: Vector3<T> = _

Required Methods§

Source

fn look_at_xy(pos: Vector3<T>, look_at: Vector3<T>) -> Self

Generate a rotation for an object at a position look at a point. only uses the X and Y rotation axes to arrive at this result Z rotation axis

 ↻
 |  locked Z rotation axis
 | /
 o ---- ⤺
§Arguments
  • pos - A Vector3<f32> representing the position of the object
  • look_at - A Vector3<f32> representing the position the object is to look at
Source

fn look_at_xz(pos: Vector3<T>, look_at: Vector3<T>) -> Self

Generate a rotation for an object at a position look at a point. only uses the X and Z rotation axes to arrive at this result Z rotation axis

 locked Y rotation axis
 |  ⤺
 | /
 o ---- ⤺
§Arguments
  • pos - A Vector3<f32> representing the position of the object
  • look_at - A Vector3<f32> representing the position the object is to look at
Source

fn look_at_yz(pos: Vector3<T>, look_at: Vector3<T>) -> Self

Generate a rotation for an object at a position look at a point. only uses the Z and Y rotation axes to arrive at this result Z rotation axis

 ↻
 |  ⤺
 | /
 o ---- locked X rotation axis
§Arguments
  • pos - A Vector3<f32> representing the position of the object
  • look_at - A Vector3<f32> representing the position the object is to look at
Source

fn look_at_lock( pos: Vector3<T>, look_at: Vector3<T>, locked_axis: Vector3<T>, ) -> Self

Generate a rotation for an object at a position look at a point. only uses the Z and Y rotation axes to arrive at this result Z rotation axis

 ↻
 |  ⤺
 | /
 o ---- ⤺
  \
   locked_axis
§Arguments
  • pos - A Vector3<f32> representing the position of the object
  • look_at - A Vector3<f32> representing the position the object is to look at
Source

fn camera_look_at_xy(pos: Vector3<T>, look_at: Vector3<T>) -> Self

Camera Objects look along the -Z axis so the look_at function for a camera object needs to be modified a little. flipping the pos and the look_at should do the trick. TODO: finish comments watch out bc z is reversed and things may get wonky

   ^ Z
   |
   |
Y• C ------> X
  / \
 /   \
/     \
§Arguments
  • pos - A Vector3<f32> representing the position of the camera
  • look_at - A Vector3<f32> representing the position the camera is to look at
Source

fn camera_look_at_xz(pos: Vector3<T>, look_at: Vector3<T>) -> Self

Source

fn camera_look_at_yz(pos: Vector3<T>, look_at: Vector3<T>) -> Self

Source

fn camera_look_at_lock( pos: Vector3<T>, look_at: Vector3<T>, locked_axis: Vector3<T>, ) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> Rotation<T> for Euler<T>
where T: Construct<T>,

Source§

impl<T> Rotation<T> for Quaternion<T>
where T: Construct<T>,

Source§

impl<T> Rotation<T> for Rotor<T>
where T: Construct<T>,