pub struct Vector4 {
pub x: f64,
pub y: f64,
pub z: f64,
pub w: f64,
}Expand description
A four-dimensional vector.
Fields§
§x: f64The x component.
y: f64The y component.
z: f64The z component.
w: f64The w component.
Implementations§
Source§impl Vector4
impl Vector4
Sourcepub fn magnitude_squared(self) -> f64
pub fn magnitude_squared(self) -> f64
Returns the squared Euclidean magnitude.
Sourcepub fn normalize(self) -> Option<Self>
pub fn normalize(self) -> Option<Self>
Returns a normalized vector when the magnitude is finite and non-zero.
Returns None for zero vectors or vectors with non-finite magnitude.
Sourcepub fn distance_squared(self, other: Self) -> f64
pub fn distance_squared(self, other: Self) -> f64
Returns the squared Euclidean distance to other.
Trait Implementations§
impl Copy for Vector4
impl StructuralPartialEq for Vector4
Auto Trait Implementations§
impl Freeze for Vector4
impl RefUnwindSafe for Vector4
impl Send for Vector4
impl Sync for Vector4
impl Unpin for Vector4
impl UnsafeUnpin for Vector4
impl UnwindSafe for Vector4
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