pub struct Vector3 {
pub x: f64,
pub y: f64,
pub z: f64,
}Expand description
3D Vector
Fields§
§x: f64§y: f64§z: f64Implementations§
Source§impl Vector3
impl Vector3
pub const fn unit_y() -> Self
pub const fn unit_z() -> Self
pub const fn down() -> Self
pub const fn left() -> Self
pub const fn right() -> Self
pub const fn forward() -> Self
pub const fn back() -> Self
Sourcepub fn length_squared(self) -> f64
pub fn length_squared(self) -> f64
Squared magnitude (avoids sqrt)
Sourcepub fn distance_squared(self, other: Self) -> f64
pub fn distance_squared(self, other: Self) -> f64
Squared distance (avoids sqrt)
Sourcepub fn project_onto(self, onto: Self) -> Self
pub fn project_onto(self, onto: Self) -> Self
Project vector onto another
Sourcepub fn to_vector4_dir(self) -> Vector4
pub fn to_vector4_dir(self) -> Vector4
Convert to Vector4 with w=0 (direction)
Sourcepub fn to_vector4_point(self) -> Vector4
pub fn to_vector4_point(self) -> Vector4
Convert to Vector4 with w=1 (point)
Trait Implementations§
impl Copy for Vector3
impl StructuralPartialEq for Vector3
Auto Trait Implementations§
impl Freeze for Vector3
impl RefUnwindSafe for Vector3
impl Send for Vector3
impl Sync for Vector3
impl Unpin for Vector3
impl UnwindSafe for Vector3
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> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.