[][src]Trait nphysics2d::joint::JointConstraint

pub trait JointConstraint<N: RealField, Bodies: BodySet<N>>: NonlinearConstraintGenerator<N, Bodies> + Downcast + Send + Sync {
    fn num_velocity_constraints(&self) -> usize;
fn anchors(
        &self
    ) -> (BodyPartHandle<Bodies::Handle>, BodyPartHandle<Bodies::Handle>);
fn velocity_constraints(
        &mut self,
        parameters: &IntegrationParameters<N>,
        bodies: &Bodies,
        ext_vels: &DVector<N>,
        ground_j_id: &mut usize,
        j_id: &mut usize,
        jacobians: &mut [N],
        velocity_constraints: &mut LinearConstraints<N, usize>
    );
fn cache_impulses(&mut self, constraints: &LinearConstraints<N, usize>); fn is_active(&self, bodies: &Bodies) -> bool { ... } }

Trait implemented by joint that operate by generating constraints to restrict the relative motion of two body parts.

Required methods

fn num_velocity_constraints(&self) -> usize

The maximum number of velocity constraints generated by this joint.

fn anchors(
    &self
) -> (BodyPartHandle<Bodies::Handle>, BodyPartHandle<Bodies::Handle>)

The two body parts affected by this joint.

fn velocity_constraints(
    &mut self,
    parameters: &IntegrationParameters<N>,
    bodies: &Bodies,
    ext_vels: &DVector<N>,
    ground_j_id: &mut usize,
    j_id: &mut usize,
    jacobians: &mut [N],
    velocity_constraints: &mut LinearConstraints<N, usize>
)

Initialize and retrieve all the constraints appied to the bodies attached to this joint.

fn cache_impulses(&mut self, constraints: &LinearConstraints<N, usize>)

Called after velocity constraint resolution, allows the joint to keep a cache of impulses generated for each constraint.

Loading content...

Provided methods

fn is_active(&self, bodies: &Bodies) -> bool

Return true if the constraint is active.

Typically, a constraint is disable if it is between two sleeping bodies, or, between bodies without any degrees of freedom.

Loading content...

Methods

impl<N, Bodies> dyn JointConstraint<N, Bodies> where
    N: Any + 'static,
    Bodies: Any + 'static,
    N: RealField,
    Bodies: BodySet<N>, 

pub fn is<__T: JointConstraint<N, Bodies>>(&self) -> bool

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

pub fn downcast<__T: JointConstraint<N, Bodies>>(
    self: Box<Self>
) -> Result<Box<__T>, Box<Self>>

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_ref<__T: JointConstraint<N, Bodies>>(&self) -> Option<&__T>

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: JointConstraint<N, Bodies>>(
    &mut self
) -> Option<&mut __T>

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, Handle: BodyHandle, Bodies: BodySet<N, Handle = Handle>> JointConstraint<N, Bodies> for CartesianConstraint<N, Handle>[src]

impl<N: RealField, Handle: BodyHandle, Bodies: BodySet<N, Handle = Handle>> JointConstraint<N, Bodies> for FixedConstraint<N, Handle>[src]

impl<N: RealField, Handle: BodyHandle, Bodies: BodySet<N, Handle = Handle>> JointConstraint<N, Bodies> for MouseConstraint<N, Handle>[src]

impl<N: RealField, Handle: BodyHandle, Bodies: BodySet<N, Handle = Handle>> JointConstraint<N, Bodies> for PrismaticConstraint<N, Handle>[src]

impl<N: RealField, Handle: BodyHandle, Bodies: BodySet<N, Handle = Handle>> JointConstraint<N, Bodies> for RevoluteConstraint<N, Handle>[src]

Loading content...