pub struct Vector3D {
pub x: f64,
pub y: f64,
pub z: f64,
}Expand description
Simple 3D vector for examples that don’t require heavy math
Fields§
§x: f64§y: f64§z: f64Implementations§
Source§impl Vector3D
impl Vector3D
pub fn new(x: f64, y: f64, z: f64) -> Self
pub fn zero() -> Self
pub fn distance(&self, other: &Vector3D) -> f64
pub fn magnitude(&self) -> f64
pub fn norm(&self) -> f64
pub fn zeros() -> Self
pub fn dot(&self, other: &Vector3D) -> f64
pub fn iter(&self) -> impl Iterator<Item = f64>
Trait Implementations§
Source§impl AddAssign for Vector3D
impl AddAssign for Vector3D
Source§fn add_assign(&mut self, other: Vector3D)
fn add_assign(&mut self, other: Vector3D)
Performs the
+= operation. Read moreSource§impl<'de> Deserialize<'de> for Vector3D
impl<'de> Deserialize<'de> for Vector3D
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 Copy for Vector3D
impl StructuralPartialEq for Vector3D
Auto Trait Implementations§
impl Freeze for Vector3D
impl RefUnwindSafe for Vector3D
impl Send for Vector3D
impl Sync for Vector3D
impl Unpin for Vector3D
impl UnwindSafe for Vector3D
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> 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.