[−][src]Struct myelin_engine::simulation::SimulationImpl
Implementation of Simulation that uses a physical
World in order to apply physics to objects.
Methods
impl<T> SimulationImpl<T> where
T: AssociatedObjectData, [src]
T: AssociatedObjectData,
pub fn new(
world: Box<dyn World>,
world_interactor_factory_fn: Box<WorldInteractorFactoryFn<T>>,
instant_wrapper_factory_fn: Box<InstantWrapperFactoryFn>
) -> Self[src]
world: Box<dyn World>,
world_interactor_factory_fn: Box<WorldInteractorFactoryFn<T>>,
instant_wrapper_factory_fn: Box<InstantWrapperFactoryFn>
) -> Self
Create a new SimulationImpl by injecting a World
Examples
use myelin_engine::prelude::*; use myelin_engine::simulation::time::InstantWrapperImpl; use myelin_engine::simulation::world::NphysicsWorld; use myelin_engine::simulation::SimulationImpl; use myelin_engine::world_interactor::WorldInteractorImpl; use std::sync::{Arc, RwLock}; use std::time::Instant; let world = Box::new(NphysicsWorld::with_timestep(1.0)); let simulation = SimulationImpl::<()>::new( world, Box::new(|simulation, id| Box::new(WorldInteractorImpl::new(simulation, id))), Box::new(|| Box::new(InstantWrapperImpl::new(Instant::now()))), );
Trait Implementations
impl<T> Simulation<T> for SimulationImpl<T> where
T: AssociatedObjectData, [src]
T: AssociatedObjectData,
fn step(&mut self)[src]
fn add_object(
&mut self,
object_description: ObjectDescription<T>,
object_behavior: Box<dyn ObjectBehavior<T>>
) -> Object<T>[src]
&mut self,
object_description: ObjectDescription<T>,
object_behavior: Box<dyn ObjectBehavior<T>>
) -> Object<T>
fn objects(&self) -> Snapshot<T>[src]
fn object(&self, id: Id) -> Option<Object<T>>[src]
fn set_simulated_timestep(&mut self, timestep: f64)[src]
fn objects_in_area(&self, area: Aabb) -> Snapshot<T>[src]
fn objects_in_polygon(&self, area: &Polygon) -> Snapshot<T>[src]
fn objects_in_ray(&self, origin: Point, direction: Vector) -> Snapshot<T>[src]
impl<T> Interactable<T> for SimulationImpl<T> where
T: AssociatedObjectData, [src]
T: AssociatedObjectData,
fn objects_in_area(&self, area: Aabb) -> Snapshot<T>[src]
fn objects_in_polygon(&self, area: &Polygon) -> Snapshot<T>[src]
fn objects_in_ray(&self, origin: Point, direction: Vector) -> Snapshot<T>[src]
fn elapsed_time_in_update(&self) -> Duration[src]
fn object(&self, id: Id) -> Option<Object<T>>[src]
impl<T> Debug for SimulationImpl<T> where
T: Debug, [src]
T: Debug,
Auto Trait Implementations
impl<T> !Send for SimulationImpl<T>
impl<T> !Sync for SimulationImpl<T>
Blanket Implementations
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>, [src]
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>[src]
fn is_in_subset(&self) -> bool[src]
unsafe fn to_subset_unchecked(&self) -> SS[src]
fn from_subset(element: &SS) -> SP[src]
impl<T> Downcast for T where
T: Any,
T: Any,