[][src]Trait nphysics2d::object::Body

pub trait Body<N: RealField>: Downcast + Send + Sync {
    pub fn update_kinematics(&mut self);
pub fn update_dynamics(&mut self, dt: N);
pub fn update_acceleration(
        &mut self,
        gravity: &Vector<N>,
        parameters: &IntegrationParameters<N>
    );
pub fn clear_forces(&mut self);
pub fn clear_update_flags(&mut self);
pub fn update_status(&self) -> BodyUpdateStatus;
pub fn apply_displacement(&mut self, disp: &[N]);
pub fn status(&self) -> BodyStatus;
pub fn set_status(&mut self, status: BodyStatus);
pub fn activation_status(&self) -> &ActivationStatus<N>;
pub fn set_deactivation_threshold(&mut self, threshold: Option<N>);
pub fn ndofs(&self) -> usize;
pub fn generalized_acceleration(&self) -> DVectorSlice<'_, N>;
pub fn generalized_velocity(&self) -> DVectorSlice<'_, N>;
pub fn companion_id(&self) -> usize;
pub fn set_companion_id(&mut self, id: usize);
pub fn generalized_velocity_mut(&mut self) -> DVectorSliceMut<'_, N>;
pub fn integrate(&mut self, parameters: &IntegrationParameters<N>);
pub fn activate_with_energy(&mut self, energy: N);
pub fn deactivate(&mut self);
pub fn num_parts(&self) -> usize;
pub fn part(&self, i: usize) -> Option<&dyn BodyPart<N>>;
pub fn deformed_positions(&self) -> Option<(DeformationsType, &[N])>;
pub fn deformed_positions_mut(
        &mut self
    ) -> Option<(DeformationsType, &mut [N])>;
pub fn fill_constraint_geometry(
        &self,
        part: &dyn BodyPart<N>,
        ndofs: usize,
        center: &Point<N>,
        dir: &ForceDirection<N>,
        j_id: usize,
        wj_id: usize,
        jacobians: &mut [N],
        inv_r: &mut N,
        ext_vels: Option<&DVectorSlice<'_, N>>,
        out_vel: Option<&mut N>
    );
pub fn world_point_at_material_point(
        &self,
        part: &dyn BodyPart<N>,
        point: &Point<N>
    ) -> Point<N>;
pub fn position_at_material_point(
        &self,
        part: &dyn BodyPart<N>,
        point: &Point<N>
    ) -> Isometry<N>;
pub fn material_point_at_world_point(
        &self,
        part: &dyn BodyPart<N>,
        point: &Point<N>
    ) -> Point<N>;
pub fn has_active_internal_constraints(&mut self) -> bool;
pub fn setup_internal_velocity_constraints(
        &mut self,
        ext_vels: &DVectorSlice<'_, N>,
        parameters: &IntegrationParameters<N>
    );
pub fn warmstart_internal_velocity_constraints(
        &mut self,
        dvels: &mut DVectorSliceMut<'_, N>
    );
pub fn step_solve_internal_velocity_constraints(
        &mut self,
        dvels: &mut DVectorSliceMut<'_, N>
    );
pub fn step_solve_internal_position_constraints(
        &mut self,
        parameters: &IntegrationParameters<N>
    );
pub fn gravity_enabled(&self) -> bool;
pub fn enable_gravity(&mut self, enabled: bool);
pub fn velocity_at_point(
        &self,
        part_id: usize,
        point: &Point<N>
    ) -> Velocity<N>;
pub fn apply_force(
        &mut self,
        part_id: usize,
        force: &Force<N>,
        force_type: ForceType,
        auto_wake_up: bool
    );
pub fn apply_local_force(
        &mut self,
        part_id: usize,
        force: &Force<N>,
        force_type: ForceType,
        auto_wake_up: bool
    );
pub fn apply_force_at_point(
        &mut self,
        part_id: usize,
        force: &Vector<N>,
        point: &Point<N>,
        force_type: ForceType,
        auto_wake_up: bool
    );
pub fn apply_local_force_at_point(
        &mut self,
        part_id: usize,
        force: &Vector<N>,
        point: &Point<N>,
        force_type: ForceType,
        auto_wake_up: bool
    );
pub fn apply_force_at_local_point(
        &mut self,
        part_id: usize,
        force: &Vector<N>,
        point: &Point<N>,
        force_type: ForceType,
        auto_wake_up: bool
    );
pub fn apply_local_force_at_local_point(
        &mut self,
        part_id: usize,
        force: &Vector<N>,
        point: &Point<N>,
        force_type: ForceType,
        auto_wake_up: bool
    ); pub fn is_ground(&self) -> bool { ... }
pub fn update_activation_status(&mut self) { ... }
pub fn advance(&mut self, _time_ratio: N) { ... }
pub fn validate_advancement(&mut self) { ... }
pub fn clamp_advancement(&mut self) { ... }
pub fn part_motion(
        &self,
        _part_id: usize,
        _time_origin: N
    ) -> Option<BodyPartMotion<N>> { ... }
pub fn step_started(&mut self) { ... }
pub fn add_local_inertia_and_com(
        &mut self,
        _part_index: usize,
        _com: Point<N>,
        _inertia: Inertia<N>
    ) { ... }
pub fn status_dependent_ndofs(&self) -> usize { ... }
pub fn status_dependent_body_part_velocity(
        &self,
        part: &dyn BodyPart<N>
    ) -> Velocity<N> { ... }
pub fn is_active(&self) -> bool { ... }
pub fn is_dynamic(&self) -> bool { ... }
pub fn is_kinematic(&self) -> bool { ... }
pub fn is_static(&self) -> bool { ... }
pub fn activate(&mut self) { ... } }

Trait implemented by all bodies supported by nphysics.

Required methods

pub fn update_kinematics(&mut self)[src]

Updates the kinematics, e.g., positions and jacobians, of this body.

pub fn update_dynamics(&mut self, dt: N)[src]

Update the dynamics property of this body.

pub fn update_acceleration(
    &mut self,
    gravity: &Vector<N>,
    parameters: &IntegrationParameters<N>
)
[src]

Update the acceleration of this body given the forces it is subject to and the gravity.

pub fn clear_forces(&mut self)[src]

Reset the timestep-specific dynamic information of this body.

pub fn clear_update_flags(&mut self)[src]

Clear all the update flags of this body.

pub fn update_status(&self) -> BodyUpdateStatus[src]

The flags tracking what modifications were applied to a body.

pub fn apply_displacement(&mut self, disp: &[N])[src]

Applies a generalized displacement to this body.

pub fn status(&self) -> BodyStatus[src]

The status of this body.

pub fn set_status(&mut self, status: BodyStatus)[src]

Set the status of this body.

pub fn activation_status(&self) -> &ActivationStatus<N>[src]

Information regarding activation and deactivation (sleeping) of this body.

pub fn set_deactivation_threshold(&mut self, threshold: Option<N>)[src]

Sets the energy bellow which this body is put to sleep.

If set to None the body will never sleep.

pub fn ndofs(&self) -> usize[src]

The number of degrees of freedom of this body.

pub fn generalized_acceleration(&self) -> DVectorSlice<'_, N>[src]

The generalized accelerations at each degree of freedom of this body.

pub fn generalized_velocity(&self) -> DVectorSlice<'_, N>[src]

The generalized velocities of this body.

pub fn companion_id(&self) -> usize[src]

The companion ID of this body.

pub fn set_companion_id(&mut self, id: usize)[src]

Set the companion ID of this body (may be reinitialized by nphysics).

pub fn generalized_velocity_mut(&mut self) -> DVectorSliceMut<'_, N>[src]

The mutable generalized velocities of this body.

pub fn integrate(&mut self, parameters: &IntegrationParameters<N>)[src]

Integrate the position of this body.

pub fn activate_with_energy(&mut self, energy: N)[src]

Force the activation of this body with the given level of energy.

pub fn deactivate(&mut self)[src]

Put this body to sleep.

pub fn num_parts(&self) -> usize[src]

The number of parts of this body.

pub fn part(&self, i: usize) -> Option<&dyn BodyPart<N>>[src]

A reference to the specified body part.

pub fn deformed_positions(&self) -> Option<(DeformationsType, &[N])>[src]

If this is a deformable body, returns its deformed positions.

pub fn deformed_positions_mut(&mut self) -> Option<(DeformationsType, &mut [N])>[src]

If this is a deformable body, returns a mutable reference to its deformed positions.

pub fn fill_constraint_geometry(
    &self,
    part: &dyn BodyPart<N>,
    ndofs: usize,
    center: &Point<N>,
    dir: &ForceDirection<N>,
    j_id: usize,
    wj_id: usize,
    jacobians: &mut [N],
    inv_r: &mut N,
    ext_vels: Option<&DVectorSlice<'_, N>>,
    out_vel: Option<&mut N>
)
[src]

Fills all the jacobians (and the jacobians multiplied by the inverse augmented mass matrix) for a constraint applying a force at the point center (relative to the body part's center of mass) and the direction dir.

If the force is a torque, it is applied at the center of mass of the body part.

pub fn world_point_at_material_point(
    &self,
    part: &dyn BodyPart<N>,
    point: &Point<N>
) -> Point<N>
[src]

Transform the given point expressed in material coordinates to world-space.

pub fn position_at_material_point(
    &self,
    part: &dyn BodyPart<N>,
    point: &Point<N>
) -> Isometry<N>
[src]

Transform the given point expressed in material coordinates to world-space.

pub fn material_point_at_world_point(
    &self,
    part: &dyn BodyPart<N>,
    point: &Point<N>
) -> Point<N>
[src]

Transform the given point expressed in material coordinates to world-space.

pub fn has_active_internal_constraints(&mut self) -> bool[src]

Returns true if this bodies contains internal constraints that need to be solved.

pub fn setup_internal_velocity_constraints(
    &mut self,
    ext_vels: &DVectorSlice<'_, N>,
    parameters: &IntegrationParameters<N>
)
[src]

Initializes the internal velocity constraints of a body.

pub fn warmstart_internal_velocity_constraints(
    &mut self,
    dvels: &mut DVectorSliceMut<'_, N>
)
[src]

For warmstarting the solver, modifies the delta velocity applied by the internal constraints of this body.

pub fn step_solve_internal_velocity_constraints(
    &mut self,
    dvels: &mut DVectorSliceMut<'_, N>
)
[src]

Execute one step for the iterative resolution of this body's internal velocity constraints.

pub fn step_solve_internal_position_constraints(
    &mut self,
    parameters: &IntegrationParameters<N>
)
[src]

Execute one step for the iterative resolution of this body's internal position constraints.

pub fn gravity_enabled(&self) -> bool[src]

Whether this body is affected by gravity.

pub fn enable_gravity(&mut self, enabled: bool)[src]

Enable or disable gravity for this body.

pub fn velocity_at_point(&self, part_id: usize, point: &Point<N>) -> Velocity<N>[src]

Gets the velocity of the given point of this body.

pub fn apply_force(
    &mut self,
    part_id: usize,
    force: &Force<N>,
    force_type: ForceType,
    auto_wake_up: bool
)
[src]

Apply a force at the center of mass of a part of this body.

pub fn apply_local_force(
    &mut self,
    part_id: usize,
    force: &Force<N>,
    force_type: ForceType,
    auto_wake_up: bool
)
[src]

Apply a local force at the center of mass of a part of this body.

pub fn apply_force_at_point(
    &mut self,
    part_id: usize,
    force: &Vector<N>,
    point: &Point<N>,
    force_type: ForceType,
    auto_wake_up: bool
)
[src]

Apply a force at a given point of a part of this body.

pub fn apply_local_force_at_point(
    &mut self,
    part_id: usize,
    force: &Vector<N>,
    point: &Point<N>,
    force_type: ForceType,
    auto_wake_up: bool
)
[src]

Apply a local force at a given point of a part of this body.

pub fn apply_force_at_local_point(
    &mut self,
    part_id: usize,
    force: &Vector<N>,
    point: &Point<N>,
    force_type: ForceType,
    auto_wake_up: bool
)
[src]

Apply a force at a given local point of a part of this body.

pub fn apply_local_force_at_local_point(
    &mut self,
    part_id: usize,
    force: &Vector<N>,
    point: &Point<N>,
    force_type: ForceType,
    auto_wake_up: bool
)
[src]

Apply a local force at a given local point of a part of this body.

Loading content...

Provided methods

pub fn is_ground(&self) -> bool[src]

Returns true if this body is the ground.

pub fn update_activation_status(&mut self)[src]

Update whether this body needs to be waken up after a user-interaction.

pub fn advance(&mut self, _time_ratio: N)[src]

pub fn validate_advancement(&mut self)[src]

pub fn clamp_advancement(&mut self)[src]

pub fn part_motion(
    &self,
    _part_id: usize,
    _time_origin: N
) -> Option<BodyPartMotion<N>>
[src]

pub fn step_started(&mut self)[src]

pub fn add_local_inertia_and_com(
    &mut self,
    _part_index: usize,
    _com: Point<N>,
    _inertia: Inertia<N>
)
[src]

Add the given inertia to the local inertia of this body part.

pub fn status_dependent_ndofs(&self) -> usize[src]

The number of degrees of freedom (DOF) of this body, taking its status into account.

In particular, this returns 0 for any body with a status different than BodyStatus::Dynamic.

pub fn status_dependent_body_part_velocity(
    &self,
    part: &dyn BodyPart<N>
) -> Velocity<N>
[src]

The velocity of the specified body part, taking this body status into account.

This will return a zero velocity for any body with a status different than BodyStatus::Dynamic.

pub fn is_active(&self) -> bool[src]

Check if this body is active.

pub fn is_dynamic(&self) -> bool[src]

Whether or not the status of this body is dynamic.

pub fn is_kinematic(&self) -> bool[src]

Whether or not the status of this body is kinematic.

pub fn is_static(&self) -> bool[src]

Whether or not the status of this body is static.

pub fn activate(&mut self)[src]

Force the activation of this body.

Loading content...

Implementations

impl<N> dyn Body<N> where
    N: Any + 'static,
    N: RealField
[src]

pub fn is<__T: Body<N>>(&self) -> bool[src]

Returns true if the trait object wraps an object of type __T.

pub fn downcast<__T: Body<N>>(self: Box<Self>) -> Result<Box<__T>, Box<Self>>[src]

Returns a boxed object from a boxed trait object if the underlying object is of type __T. Returns the original boxed trait if it isn't.

pub fn downcast_rc<__T: Body<N>>(self: Rc<Self>) -> Result<Rc<__T>, Rc<Self>>[src]

Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of type __T. Returns the original Rc-ed trait if it isn't.

pub fn downcast_ref<__T: Body<N>>(&self) -> Option<&__T>[src]

Returns a reference to the object within the trait object if it is of type __T, or None if it isn't.

pub fn downcast_mut<__T: Body<N>>(&mut self) -> Option<&mut __T>[src]

Returns a mutable reference to the object within the trait object if it is of type __T, or None if it isn't.

Implementors

impl<N: RealField> Body<N> for FEMSurface<N>[src]

pub fn update_dynamics(&mut self, dt: N)[src]

Update the dynamics property of this deformable surface.

pub fn update_acceleration(
    &mut self,
    gravity: &Vector<N>,
    parameters: &IntegrationParameters<N>
)
[src]

Update the dynamics property of this deformable surface.

impl<N: RealField> Body<N> for Ground<N>[src]

impl<N: RealField> Body<N> for MassConstraintSystem<N>[src]

impl<N: RealField> Body<N> for MassSpringSystem<N>[src]

impl<N: RealField> Body<N> for Multibody<N>[src]

impl<N: RealField> Body<N> for RigidBody<N>[src]

Loading content...