pub struct ThreeVec { /* private fields */ }Expand description
Three Vector
Implementations§
Source§impl ThreeVec
impl ThreeVec
Sourcepub fn x0(&self) -> &f64
pub fn x0(&self) -> &f64
Returns a reference to the first element of the vector
§Example
use calcify::ThreeVec;
let vec3 = ThreeVec::new(1.0,2.0,3.0);
let element_zero: f64 = *vec3.x0();
assert_eq!(element_zero,1.0);Sourcepub fn x1(&self) -> &f64
pub fn x1(&self) -> &f64
Returns a reference to the second element of the vector
§Example
use calcify::ThreeVec;
let vec3 = ThreeVec::new(1.0,2.0,3.0);
let element_one: f64 = *vec3.x1();
assert_eq!(element_one,2.0);Trait Implementations§
Source§impl AddAssign for ThreeVec
impl AddAssign for ThreeVec
Source§fn add_assign(&mut self, other: ThreeVec)
fn add_assign(&mut self, other: ThreeVec)
Performs the
+= operation. Read moreSource§impl Deserializable for ThreeVec
impl Deserializable for ThreeVec
Source§impl Mul<ThreeVec> for ThreeMat
impl Mul<ThreeVec> for ThreeMat
Source§fn mul(self, other: ThreeVec) -> ThreeVec
fn mul(self, other: ThreeVec) -> ThreeVec
Matrix multiplication with vector
§Note
Only works in one direction ThreeMat*ThreeVec, implying ThreeVec as a column vector.
§Example
use calcify::ThreeMat;
use calcify::ThreeVec;
let mat3 = ThreeMat::new(ThreeVec::new(1.0,2.0,3.0),
ThreeVec::new(1.0,2.0,3.0),
ThreeVec::new(1.0,2.0,3.0));
assert_eq!(
mat3*ThreeVec::new(2.0,2.0,2.0),
ThreeVec::new(12.0,12.0,12.0)
);Source§impl Serializable for ThreeVec
impl Serializable for ThreeVec
Source§impl SubAssign for ThreeVec
impl SubAssign for ThreeVec
Source§fn sub_assign(&mut self, other: ThreeVec)
fn sub_assign(&mut self, other: ThreeVec)
Performs the
-= operation. Read moreimpl Copy for ThreeVec
impl StructuralPartialEq for ThreeVec
Auto Trait Implementations§
impl Freeze for ThreeVec
impl RefUnwindSafe for ThreeVec
impl Send for ThreeVec
impl Sync for ThreeVec
impl Unpin for ThreeVec
impl UnwindSafe for ThreeVec
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