sim.physics2D.constraint
Class Collision

java.lang.Object
  extended by sim.physics2D.constraint.Collision
All Implemented Interfaces:
ImpulseConstraint

public class Collision
extends java.lang.Object
implements ImpulseConstraint

Created when a collision is detected between two objects and used to solve for the collision impulses.


Field Summary
 PhysicalObject2D obj1
           
 PhysicalObject2D obj2
           
 
Constructor Summary
Collision()
           
 
Method Summary
 void AddPhysicalObject(PhysicalObject2D mobjRigidBody)
           
 void AddPhysicalObject(PhysicalObject2D mobjRigidBody, Double2D connectionPoint)
          Add a physical object to the collision and specify the vector pointing from the center of the object to the collision point.
 void applyImpulses(int curAnswerRow, Vector answers)
          Applies the calculated impulses to the objects involved in the collision
 int GetCollisionResponseRows()
          Returns the number of rows in the collision response matrix
 void setCollisionMatrices(int curConstraintRow, BorderedDiagonalIdentityMatrix collisionMatrix, Vector answerVector)
          Sets the blocks of the global matrices represented by this collision
 void setColNormal(Double2D colNormal)
           
 void setRelVel(double relVel)
          Sets the relative velocity along the collision normal
 void setSticky()
          Set this collision to be perfectly inelastic
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

obj1

public PhysicalObject2D obj1

obj2

public PhysicalObject2D obj2
Constructor Detail

Collision

public Collision()
Method Detail

setSticky

public void setSticky()
Set this collision to be perfectly inelastic


GetCollisionResponseRows

public int GetCollisionResponseRows()
Returns the number of rows in the collision response matrix

Specified by:
GetCollisionResponseRows in interface ImpulseConstraint

setColNormal

public void setColNormal(Double2D colNormal)

setRelVel

public void setRelVel(double relVel)
Sets the relative velocity along the collision normal


AddPhysicalObject

public void AddPhysicalObject(PhysicalObject2D mobjRigidBody)

AddPhysicalObject

public void AddPhysicalObject(PhysicalObject2D mobjRigidBody,
                              Double2D connectionPoint)
Add a physical object to the collision and specify the vector pointing from the center of the object to the collision point.


setCollisionMatrices

public void setCollisionMatrices(int curConstraintRow,
                                 BorderedDiagonalIdentityMatrix collisionMatrix,
                                 Vector answerVector)
Sets the blocks of the global matrices represented by this collision

Specified by:
setCollisionMatrices in interface ImpulseConstraint

applyImpulses

public void applyImpulses(int curAnswerRow,
                          Vector answers)
Applies the calculated impulses to the objects involved in the collision

Specified by:
applyImpulses in interface ImpulseConstraint