pub struct Position3D {
pub x: f32,
pub y: f32,
pub z: f32,
}Expand description
3D position in space
Fields§
§x: f32X coordinate (left-right)
y: f32Y coordinate (up-down)
z: f32Z coordinate (front-back)
Implementations§
Source§impl Position3D
impl Position3D
Sourcepub fn distance_to(&self, other: &Position3D) -> f32
pub fn distance_to(&self, other: &Position3D) -> f32
Distance to another position
Sourcepub fn dot(&self, other: &Position3D) -> f32
pub fn dot(&self, other: &Position3D) -> f32
Calculate dot product with another position vector
Sourcepub fn normalized(&self) -> Position3D
pub fn normalized(&self) -> Position3D
Get normalized vector (unit vector)
Sourcepub fn cross(&self, other: &Position3D) -> Position3D
pub fn cross(&self, other: &Position3D) -> Position3D
Cross product with another vector
Sourcepub fn add(&self, other: &Position3D) -> Position3D
pub fn add(&self, other: &Position3D) -> Position3D
Vector addition
Sourcepub fn sub(&self, other: &Position3D) -> Position3D
pub fn sub(&self, other: &Position3D) -> Position3D
Vector subtraction
Sourcepub fn scale(&self, scalar: f32) -> Position3D
pub fn scale(&self, scalar: f32) -> Position3D
Scalar multiplication
Sourcepub fn lerp(&self, other: &Position3D, t: f32) -> Position3D
pub fn lerp(&self, other: &Position3D, t: f32) -> Position3D
Linear interpolation between two positions
Trait Implementations§
Source§impl Clone for Position3D
impl Clone for Position3D
Source§fn clone(&self) -> Position3D
fn clone(&self) -> Position3D
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Position3D
impl Debug for Position3D
Source§impl Default for Position3D
impl Default for Position3D
Source§impl<'de> Deserialize<'de> for Position3D
impl<'de> Deserialize<'de> for Position3D
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
Source§impl PartialEq for Position3D
impl PartialEq for Position3D
Source§impl Serialize for Position3D
impl Serialize for Position3D
impl Copy for Position3D
impl StructuralPartialEq for Position3D
Auto Trait Implementations§
impl Freeze for Position3D
impl RefUnwindSafe for Position3D
impl Send for Position3D
impl Sync for Position3D
impl Unpin for Position3D
impl UnsafeUnpin for Position3D
impl UnwindSafe for Position3D
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more