pub struct ThreeVec { /* private fields */ }
Expand description
Returns a new ThreeVec from three f64s
x0
- f64
x1
- f64
x2
- f64
use calcify::ThreeVec;
let vec3 = ThreeVec::new(1.0,2.0,3.0);
Returns a new ThreeVec from a slice
use calcify::ThreeVec;
let vec3: ThreeVec = ThreeVec::from(&[1.0,1.0,1.0]);
Returns a new ThreeVec with three random f64 from rand::Uniform between -1 and 1
max
- f64: The absolute maximum value of each individule componant of the constituent ThreeVec
use calcify::ThreeVec;
let vec3 = ThreeVec::random(10.0);
Returns a reference to the first element of the vector
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);
Returns a reference to the second element of the vector
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);
Returns a reference to the third element of the vector
use calcify::ThreeVec;
let vec3 = ThreeVec::new(1.0,2.0,3.0);
let element_two: f64 = *vec3.x2();
assert_eq!(element_two,3.0);
Returns the length of the vector
use calcify::ThreeVec;
let vec3 = ThreeVec::new(1.0,0.0,0.0);
assert_eq!(vec3.r(),1.0);
The resulting type after applying the +
operator.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Return a tuple of Self and a &u8 of remaining unparsed bytes from a byte array
Formats the value using the given formatter. Read more
The resulting type after applying the *
operator.
Dot product
use calcify::ThreeVec;
let vec3 = ThreeVec::new(2.0,2.0,2.0);
assert_eq!(
vec3*vec3,
12.0
);
The resulting type after applying the *
operator.
Matrix multiplication with vector
Only works in one direction ThreeMat*ThreeVec, implying ThreeVec as a column vector.
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)
);
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the -
operator.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Return object intensive json string Read more
Return Result wrapped Vec in MsgPack
Format is not like to_json it is array intensive not object Read more
The resulting type after applying the -
operator.
Method which takes an iterator and generates Self
from the elements by
“summing up” the items. Read more
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String
. Read more
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.