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