Consolidate RbdConstraint & PbdConstraint
The RbdConstraint & PbdConstraint could become more similar in implementation.
-
Use a flag or some other interface to indicate that a constraint, be it PbdConstraint or RbdConstraint. Should be clearable. IE: Put into a separate container that is cleared every simulation frame. -
This would require introduction of a container of constraints in RigidBodyModel that does not clear. New feature. -
Rename RbdConstraint::compute to computeValueAndGradient, to match Pbd. -
Pass in the required constraint values by reference like computeValueAndGradient. J & vu. -
Explore why computeValueGradient is not called in a loop before RigidBodyModel::Solve. -
The signs might be backwards in one of the constraint gradients (I think RbdConstraint has backward sign). -
Consider renaming PbdConstraint::initConstraint to PbdConstraint::init. Then introducing RbdConstraint::init & removing constructor initialization. -
Remove PbdCollisionConstraint. Rework all PbdConstraints to stem from the same base PbdConstraint (may not be possible performantly without templates, was attempted at numerous points, difficult).
This should make it much easier to work with the two models.
I suspect as we approach a proper solution of compliance between the two models we will arrive at something similar to PBD rigid bodies described in the paper "Detailed Rigid Body Simulation with Extended Position Based Dynamics"
Edited by Jacob Moore