pub struct ThreeVecField<'a> { /* private fields */ }Expand description
Three dimensional vector field
Implementations§
Source§impl<'a> ThreeVecField<'a>
impl<'a> ThreeVecField<'a>
Sourcepub fn new(func: &'a dyn Fn(&ThreeVec) -> ThreeVec) -> ThreeVecField<'_>
pub fn new(func: &'a dyn Fn(&ThreeVec) -> ThreeVec) -> ThreeVecField<'_>
Returns a new ThreeVecField
§Arguments
func- &’a dyn Fn(&ThreeVec) -> ThreeVec
§Example
use calcify::ThreeVec;
use calcify::ThreeVecField;
let g = ThreeVecField::new(&|tv: &ThreeVec| 2.0*(*tv));
let g2: ThreeVecField = 2.0*g;
let test_vec = ThreeVec::new(2.0,2.0,2.0);
assert_eq!(g.loc(2.0,2.0,2.0),2.0*test_vec);
assert_eq!(g.at(test_vec),ThreeVec::new(4.0,4.0,4.0));
assert_eq!(g2.loc(2.0,2.0,2.0),ThreeVec::new(8.0,8.0,8.0));Trait Implementations§
Source§impl<'a> Clone for ThreeVecField<'a>
impl<'a> Clone for ThreeVecField<'a>
Source§fn clone(&self) -> ThreeVecField<'a>
fn clone(&self) -> ThreeVecField<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Mul<ThreeVecField<'a>> for f64
impl<'a> Mul<ThreeVecField<'a>> for f64
Source§fn mul(self, other: ThreeVecField<'a>) -> ThreeVecField<'a>
fn mul(self, other: ThreeVecField<'a>) -> ThreeVecField<'a>
Scale a ThreeVecField by float from the other side.
Source§type Output = ThreeVecField<'a>
type Output = ThreeVecField<'a>
The resulting type after applying the
* operator.Source§impl<'a> Mul<f64> for ThreeVecField<'a>
impl<'a> Mul<f64> for ThreeVecField<'a>
Source§fn mul(self, coef: f64) -> ThreeVecField<'a>
fn mul(self, coef: f64) -> ThreeVecField<'a>
Scale a ThreeVecField by float.
Source§type Output = ThreeVecField<'a>
type Output = ThreeVecField<'a>
The resulting type after applying the
* operator.Source§impl<'a> Neg for ThreeVecField<'a>
impl<'a> Neg for ThreeVecField<'a>
Source§fn neg(self) -> ThreeVecField<'a>
fn neg(self) -> ThreeVecField<'a>
Negate a ThreeVecField.
Source§type Output = ThreeVecField<'a>
type Output = ThreeVecField<'a>
The resulting type after applying the
- operator.impl<'a> Copy for ThreeVecField<'a>
Auto Trait Implementations§
impl<'a> Freeze for ThreeVecField<'a>
impl<'a> !RefUnwindSafe for ThreeVecField<'a>
impl<'a> !Send for ThreeVecField<'a>
impl<'a> !Sync for ThreeVecField<'a>
impl<'a> Unpin for ThreeVecField<'a>
impl<'a> !UnwindSafe for ThreeVecField<'a>
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