Struct ODE

Source
pub struct ODE {
    pub cams: BTreeMap<usize, Cam>,
    pub t_delta: f64,
    /* private fields */
}
Expand description

ODE singleton

Fields§

§cams: BTreeMap<usize, Cam>

viewpoint(s)

§t_delta: f64

step

Implementations§

Source§

impl ODE

singleton interface

Source

pub fn new(delta: f64) -> ODE

construct (must not call it, auto instanciate by once_cell lazy)

Source

pub fn ds_as_ref() -> &'static Box<dyn Tdrawstuff>

ds trait Tdrawstuff getter

Source

pub fn open( drawstuff: impl Tdrawstuff + 'static, delta: f64, qsw: f64, qsni: usize, cmcv: f64, csl: f64, num_contact: usize, )

ODE initialize

  • drawstuff: change drawstuff
  • delta: default 0.002
  • num_contact: default 12
Source

pub fn close()

ODE finalize

Source

pub fn create_world( qsw: f64, qsni: usize, cmcv: f64, csl: f64, num_contact: usize, )

auto called by ODE::open() (custom start callback to create your objects)

Source

pub fn destroy_world()

auto called by ODE::close()

Source

pub fn modify(&mut self)

modify

Source

pub fn is_modified(&mut self, f: bool) -> bool

is modified (set false when f is false, otherwise through)

Source

pub fn num(&self) -> usize

number of elements

Source

pub fn reg_mgm(&mut self, geom: *mut dxGeom, mi: Box<dyn MetaInf>) -> [f64; 4]

reg mgm (MetaInf, TCMaterial) (geom to HashMap) returns color

Source

pub fn reg_obg(&mut self, obg: Obg) -> *mut dxBody

reg obg (body to HashMap, BTreeMap, and VecDeque) returns body

Source

pub fn creator_dm( &mut self, key: &str, mi: Box<dyn MetaInf>, fmdm: bool, ) -> (*mut dxBody, *mut dxGeom, Box<dMass>)

create primitive object (register it to show on the ODE space world)

  • fmdm: true as m, false as dm
Source

pub fn creator_m( &mut self, key: &str, mi: Box<dyn MetaInf>, ) -> (*mut dxBody, *mut dxGeom, Box<dMass>)

create primitive object as m (register it to show on the ODE space world)

Source

pub fn creator( &mut self, key: &str, mi: Box<dyn MetaInf>, ) -> (*mut dxBody, *mut dxGeom, Box<dMass>)

create primitive object as dm (register it to show on the ODE space world)

Source

pub fn creator_composite( &mut self, key: &str, mi: Box<dyn MetaInf>, ) -> (*mut dxBody, *mut dxGeom, Box<dMass>)

create composite object (register it to show on the ODE space world)

Source

pub fn get_grand_parent(&self, id: *mut dxGeom) -> *mut dxBody

search grand parent body (must check 0 as dBodyID later on the receiver)

Source

pub fn get_ancestor(&self, id: *mut dxGeom) -> (*mut dxBody, *mut dxBody)

search ancestor (parent and grand parent) body (must check 0 as dBodyID later on the receiver)

Source

pub fn is_space(&self, o: *mut dxGeom) -> bool

is space (Geom)

Source

pub fn get_ground(&self) -> *mut dxGeom

get ground (from Gws)

Source

pub fn get_contactgroup(&self) -> *mut dxJointGroup

get contactgroup (from Gws)

Source

pub fn get_contacts(&mut self, o1: *mut dxGeom, o2: *mut dxGeom) -> i32

get contacts

Source

pub fn ref_contacts_mut(&mut self) -> &mut Vec<dContact>

ref contacts mut

Source

pub fn ref_contacts(&self) -> &Vec<dContact>

ref contacts

Source

pub fn get_body_num_joints(&self, b: *mut dxBody) -> usize

get body num joints

Source

pub fn get_body_joint(&self, b: *mut dxBody, i: usize) -> *mut dxJoint

get body joint

Source

pub fn get_joint_num_bodies(&self, joint: *mut dxJoint) -> usize

get joint num bodies

Source

pub fn get_joint_body(&self, joint: *mut dxJoint, i: usize) -> *mut dxBody

get joint body

Source

pub fn is_joint_enabled(&self, joint: *mut dxJoint) -> bool

is joint enabled

Source

pub fn get_joint_type(&self, joint: *mut dxJoint) -> i32

get joint type

Source

pub fn get_joint_data(&self, joint: *mut dxJoint) -> *mut c_void

get joint data

Source

pub fn get_bounce(&self, id: *mut dxGeom) -> f64

search bounce (especially support GeomTransform)

Source

pub fn get_mu(&self, id: *mut dxGeom) -> f64

search mu (especially support GeomTransform)

Source

pub fn get_krp_mut(&mut self, id: *mut dxGeom) -> &mut Krp

search Krp mut (from HashMap)

Source

pub fn get_krp(&self, id: *mut dxGeom) -> &Krp

search Krp (from HashMap)

Source

pub fn get_mgm_mut( &mut self, id: *mut dxGeom, ) -> Result<&mut Box<dyn MetaInf>, Box<dyn Error>>

search MetaInf, TCMaterial mut (from HashMap)

Source

pub fn get_mgm( &self, id: *mut dxGeom, ) -> Result<&Box<dyn MetaInf>, Box<dyn Error>>

search MetaInf, TCMaterial (from HashMap)

Source

pub fn get_id(&self, k: String) -> Result<*mut dxBody, Box<dyn Error>>

search id (from BTreeMap)

Source

pub fn get_mut(&mut self, id: *mut dxBody) -> Result<&mut Obg, Box<dyn Error>>

search object mut (from HashMap)

Source

pub fn find_mut(&mut self, k: String) -> Result<&mut Obg, Box<dyn Error>>

search object mut (from BTreeMap and HashMap)

Source

pub fn get(&self, id: *mut dxBody) -> Result<&Obg, Box<dyn Error>>

search object (from HashMap)

Source

pub fn find(&self, k: String) -> Result<&Obg, Box<dyn Error>>

search object (from BTreeMap and HashMap)

Source

pub fn each_id<F>(&self, la: F) -> Vec<*mut dxBody>
where F: FnMut(&str, *mut dxBody) -> bool,

each_id (may use immutable result with get_mut to avoid dup mutable borrow)

  • la: FnMut(key: &str, id: dBodyID) -> bool
Source

pub fn each<F>(&self, la: F) -> bool
where F: FnMut(&str, *mut dxBody, &Obg) -> bool,

each (can break by result of lambda)

  • la: FnMut(key: &str, id: dBodyID, obg: &Obg) -> bool
Source

pub fn each_geom<F>(&self, obg: &Obg, la: F) -> bool
where F: FnMut(*mut dxGeom, &Obg) -> bool,

each geom in body (can break by result of lambda)

  • la: FnMut(g: dGeomID, obg: &Obg) -> bool
Source

pub fn destroy_obg(obg: &Obg)

destroy object (not unregister)

Source

pub fn unregister_obg(&mut self, obg: &Obg, f: bool) -> Option<Obg>

unregister object

  • f: true with destroy
Source

pub fn unregister_obg_by_id(&mut self, id: *mut dxBody, f: bool) -> Option<Obg>

unregister object by id (not destroy)

  • f: true with destroy
Source

pub fn clear_obgs()

destroy and unregister all objects

Source

pub fn clear_contactgroup()

destroy contact group and re initialize it

Source

pub fn viewpoint_()

set viewpoint (from the current viewpoint Cam[sw_viewpoint])

Source

pub fn viewpoint(f: bool)

get viewpoint (f: true, save to the current viewpoint Cam[sw_viewpoint])

Source

pub fn sim_loop(width: i32, height: i32, r_sim: Option<Box<dyn Sim>>, a: &[u8])

default simulation loop

Trait Implementations§

Source§

impl Drop for ODE

binding finalize ODE (auto called)

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Sim for ODE

trait Sim must have callback functions

Source§

fn draw_objects(&mut self)

implements drawing composite wire_solid i32 false/true for bunny

Source§

fn draw_geom( &self, geom: *mut dxGeom, pos: Option<*const f64>, rot: Option<*const f64>, ws: i32, )

draw_geom (called by draw_objects and recursive)

Source§

fn start_callback(&mut self)

start default callback function

Source§

fn near_callback(&mut self, dat: *mut c_void, o1: *mut dxGeom, o2: *mut dxGeom)

near default callback function

Source§

fn step_callback(&mut self, pause: i32)

step default callback function

Source§

fn command_callback(&mut self, cmd: i32)

command default callback function

Source§

fn stop_callback(&mut self)

stop default callback function

Source§

fn super_mut(&mut self) -> &mut ODE

self.super mutable
Source§

fn super_get(&self) -> &ODE

self.super immutable
Source§

fn set_pos_R(&mut self, b: *mut dxBody, p: [f64; 4], m: [f64; 12])

set pos and rotation (dMatrix3)
Source§

fn set_pos_Q(&mut self, b: *mut dxBody, p: [f64; 4], q: [f64; 4])

set pos and rotation (dQuaternion)
Source§

impl TdrawstuffSetter for ODE

TdrawstuffSetter for ODE

Source§

fn set_drawstuff( ds: &mut Option<Box<dyn Tdrawstuff>>, drawstuff: impl Tdrawstuff + 'static, )

set drawstuff

Auto Trait Implementations§

§

impl Freeze for ODE

§

impl !RefUnwindSafe for ODE

§

impl !Send for ODE

§

impl !Sync for ODE

§

impl Unpin for ODE

§

impl !UnwindSafe for ODE

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.