sim.physics2D.constraint
Class PinJoint

java.lang.Object
  extended by sim.physics2D.constraint.PinJoint
All Implemented Interfaces:
ForceConstraint, ImpulseConstraint

public class PinJoint
extends java.lang.Object
implements ForceConstraint, ImpulseConstraint

A PinJoint represents a point where two objects can not move relative to each other. A door hinge is an example of a pin joint - the door and the frame can not move relative to each other at the point where they are joined. PinJoint implements both ForceConstraint and ImpulseConstraint. When there are no collisions, the ForceConstraint can solve for the accelerations that keep the objects joined. If one of the objects is involved in a collision, however, the assumption of legal velocities is violated (since an impulse instanteously changes velocity). Therefore, an impulse needs to be applied at the pin joint to keep the velocities legal.


Constructor Summary
PinJoint(Double2D pos, PhysicalObject2D obj1, PhysicalObject2D obj2)
           
 
Method Summary
 void addHolonomicConstraints()
          Used in resting contact calculations
 void applyImpulses(int curAnswerRow, Vector answers)
           
 int GetCollisionResponseRows()
           
 int GetConstraintRows()
           
 void setCollisionColsMatrix()
           
 void setCollisionMatrices(int curConstraintRow, BorderedDiagonalIdentityMatrix collisionMatrix, Vector answerVector)
           
 void setConstraintMatrices(int curConstraintRow, BlockSparseMatrix jacobianMatrix, BlockSparseMatrix jacobianDotMatrix, Vector constraintVector, Vector constraintDotVector)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PinJoint

public PinJoint(Double2D pos,
                PhysicalObject2D obj1,
                PhysicalObject2D obj2)
Method Detail

GetConstraintRows

public int GetConstraintRows()
Specified by:
GetConstraintRows in interface ForceConstraint

GetCollisionResponseRows

public int GetCollisionResponseRows()
Specified by:
GetCollisionResponseRows in interface ImpulseConstraint

addHolonomicConstraints

public void addHolonomicConstraints()
Used in resting contact calculations

Specified by:
addHolonomicConstraints in interface ForceConstraint

setConstraintMatrices

public void setConstraintMatrices(int curConstraintRow,
                                  BlockSparseMatrix jacobianMatrix,
                                  BlockSparseMatrix jacobianDotMatrix,
                                  Vector constraintVector,
                                  Vector constraintDotVector)
Specified by:
setConstraintMatrices in interface ForceConstraint

setCollisionMatrices

public void setCollisionMatrices(int curConstraintRow,
                                 BorderedDiagonalIdentityMatrix collisionMatrix,
                                 Vector answerVector)
Specified by:
setCollisionMatrices in interface ImpulseConstraint

setCollisionColsMatrix

public void setCollisionColsMatrix()

applyImpulses

public void applyImpulses(int curAnswerRow,
                          Vector answers)
Specified by:
applyImpulses in interface ImpulseConstraint