pub struct System<INTG: Integrator> { /* private fields */ }
Expand description
A system representing the computational model for the simulation.
There are three categories of entities that are found in the system (model):
- Objects –
Static
,Dynamic
,Nodetect
- Forces –
Gravity
- Constraints – ‘Planar’, ‘Penetration’ (TODO)
Implementations§
Source§impl<INTG: Integrator> System<INTG>
impl<INTG: Integrator> System<INTG>
pub fn new() -> Selfwhere
INTG: Default,
pub fn step(&self) -> u64
pub fn objects_dynamic(&self) -> &VecMap<Dynamic>
pub fn objects_nodetect(&self) -> &VecMap<Nodetect>
pub fn objects_static(&self) -> &VecMap<Static>
pub fn get_object(&self, id: Id) -> VariantRef<'_>
pub fn segment_query( &self, segment: Segment3<f64>, ignore_list: &[Id], ) -> Vec<(f64, Point3<f64>, Id)>
Sourcepub fn handle_event(&mut self, input: Input) -> Vec<Output>
pub fn handle_event(&mut self, input: Input) -> Vec<Output>
Input event handling.
CreateObject
– if an object is found to be in non-colliding contact with any other objects, those contacts will be registered with the collision system as persistent contacts for the upcoming stepDestroyObject
SetGravity
ClearGravity
Step
– advance the simulation by a single timestep:-
Derivative evaluation: forces are accumulated and acceleration computed
-
Velocities are integrated
-
Velocity constraints are solved
-
Positions are integrated using the new velocity (semi-implicit Euler)
-
Position constraints are solved
-
Collision detects and resolves collisions in the normalized sub-timestep [0.0-1.0).
Note that colliding contacts detected at t==1.0 will not produce a collision response event (the next step will detect and resolve this collision), however resting or separating contacts detected at t==1.0 will be registered as a persistent contact for the next simulation step.
-
Sourcepub fn new_object_key(&self, kind: Kind) -> Option<Key>
pub fn new_object_key(&self, kind: Kind) -> Option<Key>
Returns None
if object container is full
pub fn contacts(&self) -> Vec<Vec<(Id, Id, Contact)>>
Trait Implementations§
Source§impl<'de, INTG: Integrator> Deserialize<'de> for System<INTG>
impl<'de, INTG: Integrator> Deserialize<'de> for System<INTG>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl<INTG> Freeze for System<INTG>
impl<INTG> RefUnwindSafe for System<INTG>where
INTG: RefUnwindSafe,
impl<INTG> Send for System<INTG>where
INTG: Send,
impl<INTG> Sync for System<INTG>where
INTG: Sync,
impl<INTG> Unpin for System<INTG>where
INTG: Unpin,
impl<INTG> UnwindSafe for System<INTG>where
INTG: 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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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 more