pub struct SourceCollection<S: Source<T>, T: Float> { /* private fields */ }
Expand description
Stack-allocated collection of a single source type.
§Fields
position
: Center of the collection (m), where the children reference.orientation
: Orientation of the collection, where the children reference.children
: An ordered-vec of homogeneous magnetic sources.
§Example
use magba::sources::*;
use nalgebra::*;
let magnet = CylinderMagnet::<f64>::default();
let mut collection = SourceCollection::default();
collection.add(magnet);
Implementations§
Source§impl<S: Source<T>, T: Float> SourceCollection<S, T>
impl<S: Source<T>, T: Float> SourceCollection<S, T>
Sourcepub fn new(
position: Point3<T>,
orientation: UnitQuaternion<T>,
sources: Vec<S>,
) -> Self
pub fn new( position: Point3<T>, orientation: UnitQuaternion<T>, sources: Vec<S>, ) -> Self
Initialize SourceCollection.
Sourcepub fn from_sources(sources: Vec<S>) -> Self
pub fn from_sources(sources: Vec<S>) -> Self
Initialize SourceCollection from a vec of homogeneous Source.
Sourcepub fn add_sources(&mut self, source: &mut Vec<S>)
pub fn add_sources(&mut self, source: &mut Vec<S>)
Add multiple Source to the collection.
Trait Implementations§
Source§impl<S: Source<T>, T: Float> Transform<T> for SourceCollection<S, T>
impl<S: Source<T>, T: Float> Transform<T> for SourceCollection<S, T>
Source§fn orientation(&self) -> UnitQuaternion<T>
fn orientation(&self) -> UnitQuaternion<T>
Get the object orientation.
Source§fn set_position(&mut self, position: Point3<T>)
fn set_position(&mut self, position: Point3<T>)
Set the object position.
Source§fn set_orientation(&mut self, orientation: UnitQuaternion<T>)
fn set_orientation(&mut self, orientation: UnitQuaternion<T>)
Set the object orientation.
Source§fn translate(&mut self, translation: &Translation3<T>)
fn translate(&mut self, translation: &Translation3<T>)
Translate the object.
Source§fn rotate(&mut self, rotation: &UnitQuaternion<T>)
fn rotate(&mut self, rotation: &UnitQuaternion<T>)
Rotate the object.
Source§fn rotate_anchor(&mut self, rotation: &UnitQuaternion<T>, anchor: &Point3<T>)
fn rotate_anchor(&mut self, rotation: &UnitQuaternion<T>, anchor: &Point3<T>)
Rotate the object using the anchor point as the center of rotation.
impl<S: Source<T>, T: Float> Source<T> for SourceCollection<S, T>
Auto Trait Implementations§
impl<S, T> Freeze for SourceCollection<S, T>where
T: Freeze,
impl<S, T> RefUnwindSafe for SourceCollection<S, T>where
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<S, T> Send for SourceCollection<S, T>
impl<S, T> Sync for SourceCollection<S, T>
impl<S, T> Unpin for SourceCollection<S, T>
impl<S, T> UnwindSafe for SourceCollection<S, T>where
S: UnwindSafe,
T: UnwindSafe,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§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.