pub struct Direction { /* private fields */ }Expand description
A 3-D facing direction — the direction an avatar faces, as carried by the
various look_at fields (the viewer’s agent/camera at-axis). It is a
direction, not a position: the wire stores three f32s and the viewer
uses the full 3-D vector (including any vertical component) as the forward
axis. It is conventionally a unit vector, but the wire does not enforce
normalisation, so the raw components are preserved verbatim for byte-identical
round-trips.
Implementations§
Source§impl Direction
impl Direction
Sourcepub const ZERO: Self
pub const ZERO: Self
A zero direction (the wire (0, 0, 0) sentinel the viewer replaces with
the current camera axis).
Sourcepub const fn new(x: f32, y: f32, z: f32) -> Self
pub const fn new(x: f32, y: f32, z: f32) -> Self
Creates a direction from its raw components, without normalising.
Sourcepub fn normalized(&self) -> Option<Self>
pub fn normalized(&self) -> Option<Self>
The unit-length direction, or None when the vector has (near-)zero
length and a direction is therefore undefined.
Trait Implementations§
impl Copy for Direction
Source§impl<'de> Deserialize<'de> for Direction
impl<'de> Deserialize<'de> for Direction
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Direction
Auto Trait Implementations§
impl Freeze for Direction
impl RefUnwindSafe for Direction
impl Send for Direction
impl Sync for Direction
impl Unpin for Direction
impl UnsafeUnpin for Direction
impl UnwindSafe for Direction
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
Mutably borrows from an owned value. Read more