artisynth.core.mechmodels
Class DeformableCollisionDataBase

java.lang.Object
  extended by artisynth.core.mechmodels.DeformableCollisionDataBase
All Implemented Interfaces:
CollisionData, DeformableCollisionData
Direct Known Subclasses:
EmbeddedCollisionData, FemCollisionData, MFreeCollisionData, SkinCollisionData

public abstract class DeformableCollisionDataBase
extends java.lang.Object
implements DeformableCollisionData


Constructor Summary
DeformableCollisionDataBase(PolygonalMesh mesh)
           
DeformableCollisionDataBase(PolygonalMesh mesh, DeformableContactConstraint stub)
           
 
Method Summary
 int addBilateralConstraints(SparseBlockMatrix GT, VectorNd dg, int numb)
          Adds the matrix blocks associated with the bodies contact constraints to the constraint matrix transpose.
 int addConstraintInfo(Vertex3d vtx, Point3d pnt, double weight, DeformableContactConstraint con)
          Adds the point information from this object's vertex and weight to the supplied constraint.
 void addContact(DeformableContactConstraint c)
          Add contact constraint to set of constraints
 int addFrictionConstraints(SparseBlockMatrix DT, MechSystem.FrictionInfo[] finfo, int numf)
           
 boolean allowCollision(EdgeEdgeContact eec, boolean isFirst, CollisionData otherData)
           
 void clearContactActivity()
          Deactivates all the current contact constraints.
 void clearContactData()
          Clears all the contact constraint data.
 boolean contactsHaveChanged()
          Returns true if the contact structure has changed such that the GT matrix will have a different structure and will have to be reanalyzed.
 void getAuxState(DataBuffer data, CollisionData otherData)
           
 int getBilateralImpulses(VectorNd lam, int idx)
           
 int getBilateralInfo(MechSystem.ConstraintInfo[] ginfo, int idx)
           
 void getBilateralSizes(VectorNi sizes)
           
 double getCollisionTol()
           
 DeformableContactConstraint getContact(ContactPenetratingPoint cpp, boolean isVertex)
          Gets a constraint for vertex-face contact.
 DeformableContactConstraint getContact(EdgeEdgeContact eec, boolean isFirst)
          Gets a constraint for an edge-edge contact.
 double getFriction()
           
 void getInitialAuxState(DataBuffer newData, DataBuffer oldData)
           
 PolygonalMesh getMesh()
          Gets the PolygonalMesh used for collisions
 boolean hasActiveContact(ContactPenetratingPoint cpp, boolean isVertex)
          Returns true if this FEM data set contains an active contact involving a specified vertex or pair of vertices.
 boolean hasActiveContact(EdgeEdgeContact eec, boolean isFirst)
           
 boolean hasActiveContacts()
          Determines whether or not any of the contact constraints are currently active
 int maxFrictionConstraintSets()
           
 void notifyContactsChanged()
          Notification that the components associated with a specific contact constraint has changed, and therefore the GT matrix will have a different structure for the next step.
 int numActiveContacts()
          Counts the number of contact constraints that are currently active
 void reduceConstraints(java.util.ArrayList<ContactPenetratingPoint> myPoints, java.util.ArrayList<ContactPenetratingPoint> otherPoints, CollisionData otherData)
          Culls the set of constraints to a reduced set
 void removeInactiveContacts()
          Removes all contact contraints which are currently inactive.
 void setAuxState(DataBuffer data, CollisionData other)
           
 int setBilateralImpulses(VectorNd lam, int idx)
          Sets the impulses associated with the contact constraints.
 void setFriction(double mu)
           
 void setPenetrationTol(double tol)
           
 void skipAuxState(DataBuffer data)
           
 void updateFrictionConstraints()
           
 void zeroImpulses()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface artisynth.core.mechmodels.DeformableCollisionData
allowCollision, createContact, getVertexDependencies, numActiveMasters, numActiveMasters
 
Methods inherited from interface artisynth.core.mechmodels.CollisionData
getComponent, markMasters, numActiveUnmarkedMasters
 

Constructor Detail

DeformableCollisionDataBase

public DeformableCollisionDataBase(PolygonalMesh mesh,
                                   DeformableContactConstraint stub)

DeformableCollisionDataBase

public DeformableCollisionDataBase(PolygonalMesh mesh)
Method Detail

getMesh

public PolygonalMesh getMesh()
Description copied from interface: CollisionData
Gets the PolygonalMesh used for collisions

Specified by:
getMesh in interface CollisionData
Returns:
mesh used for collisions

getBilateralSizes

public void getBilateralSizes(VectorNi sizes)
Specified by:
getBilateralSizes in interface DeformableCollisionData

getBilateralInfo

public int getBilateralInfo(MechSystem.ConstraintInfo[] ginfo,
                            int idx)
Specified by:
getBilateralInfo in interface DeformableCollisionData

addBilateralConstraints

public int addBilateralConstraints(SparseBlockMatrix GT,
                                   VectorNd dg,
                                   int numb)
Description copied from interface: DeformableCollisionData
Adds the matrix blocks associated with the bodies contact constraints to the constraint matrix transpose. This method is used when building the constraint matrix structure. Blocks should be added starting at the block column indicated by numb. The block column number is then updated and returned by this method.

Deformable contact constraints are currently implemented as bilateral constraints to save computational effort. The unilateral nature of the constraint is handled by examining its impulse after the velocity solve. If the impulse is negative, that indicates that the constraint is trying to separate and constraint is removed.

Specified by:
addBilateralConstraints in interface DeformableCollisionData
Parameters:
GT - constraint matrix transpose
numb - block column number where the blocks should begin
Returns:
updated block column number

maxFrictionConstraintSets

public int maxFrictionConstraintSets()
Specified by:
maxFrictionConstraintSets in interface DeformableCollisionData

addFrictionConstraints

public int addFrictionConstraints(SparseBlockMatrix DT,
                                  MechSystem.FrictionInfo[] finfo,
                                  int numf)
Specified by:
addFrictionConstraints in interface DeformableCollisionData

updateFrictionConstraints

public void updateFrictionConstraints()
Specified by:
updateFrictionConstraints in interface DeformableCollisionData

setBilateralImpulses

public int setBilateralImpulses(VectorNd lam,
                                int idx)
Description copied from interface: DeformableCollisionData
Sets the impulses associated with the contact constraints. This is called by the solver after performing a solve. The resulting impulse information is then used by the constraint to compute friction and to decide when contact constraints should be broken.

Specified by:
setBilateralImpulses in interface DeformableCollisionData
Parameters:
lam - vector containing impulse values
idx - starting index for constraint impulses associated with this collision pair
Returns:
updated index value (i.e., idx plus the number of contact constraints).

zeroImpulses

public void zeroImpulses()
Specified by:
zeroImpulses in interface DeformableCollisionData

getBilateralImpulses

public int getBilateralImpulses(VectorNd lam,
                                int idx)
Specified by:
getBilateralImpulses in interface DeformableCollisionData

clearContactActivity

public void clearContactActivity()
Description copied from interface: DeformableCollisionData
Deactivates all the current contact constraints. Constraints may be reactivated later if they are found in the next collision detection and are not separating.

Specified by:
clearContactActivity in interface DeformableCollisionData

hasActiveContact

public boolean hasActiveContact(ContactPenetratingPoint cpp,
                                boolean isVertex)
Description copied from interface: DeformableCollisionData
Returns true if this FEM data set contains an active contact involving a specified vertex or pair of vertices.

Specified by:
hasActiveContact in interface DeformableCollisionData

getContact

public DeformableContactConstraint getContact(ContactPenetratingPoint cpp,
                                              boolean isVertex)
Description copied from interface: DeformableCollisionData
Gets a constraint for vertex-face contact. If a matching constraint already exists and is not trying to separate, then that is returned; Otherwise, null is returned. Note that only the constraint container is found or allocated here; it's contents are set later.

Specified by:
getContact in interface DeformableCollisionData
Parameters:
cpp - the contact penetrating point, consisting of a vertex/face pair
isVertex - boolean indicating whether for this data, we own the vertex or the face
Returns:
constraint structure

getContact

public DeformableContactConstraint getContact(EdgeEdgeContact eec,
                                              boolean isFirst)
Description copied from interface: DeformableCollisionData
Gets a constraint for an edge-edge contact. If a matching constraint already exists and is not trying to separate, then that is returned; Otherwise, null is returned. Note that only the constraint container is found or allocated here; it's contents are set later.

Specified by:
getContact in interface DeformableCollisionData
Parameters:
eec - Edge-Edge contact
isFirst - indicates whether this object owns the first edge or second
Returns:
constraint structure

addContact

public void addContact(DeformableContactConstraint c)
Description copied from interface: DeformableCollisionData
Add contact constraint to set of constraints

Specified by:
addContact in interface DeformableCollisionData

hasActiveContact

public boolean hasActiveContact(EdgeEdgeContact eec,
                                boolean isFirst)
Specified by:
hasActiveContact in interface DeformableCollisionData

removeInactiveContacts

public void removeInactiveContacts()
Description copied from interface: DeformableCollisionData
Removes all contact contraints which are currently inactive. This is called after all new constraints have been determined.

Specified by:
removeInactiveContacts in interface DeformableCollisionData

hasActiveContacts

public boolean hasActiveContacts()
Description copied from interface: DeformableCollisionData
Determines whether or not any of the contact constraints are currently active

Specified by:
hasActiveContacts in interface DeformableCollisionData

numActiveContacts

public int numActiveContacts()
Description copied from interface: DeformableCollisionData
Counts the number of contact constraints that are currently active

Specified by:
numActiveContacts in interface DeformableCollisionData

notifyContactsChanged

public void notifyContactsChanged()
Description copied from interface: DeformableCollisionData
Notification that the components associated with a specific contact constraint has changed, and therefore the GT matrix will have a different structure for the next step.

Specified by:
notifyContactsChanged in interface DeformableCollisionData

contactsHaveChanged

public boolean contactsHaveChanged()
Description copied from interface: DeformableCollisionData
Returns true if the contact structure has changed such that the GT matrix will have a different structure and will have to be reanalyzed. Contact structure will change if contact constraints are added or removed, or if the components associated with a specific constraint have changed.

Specified by:
contactsHaveChanged in interface DeformableCollisionData
Returns:
true if contact structure has changed.

clearContactData

public void clearContactData()
Description copied from interface: DeformableCollisionData
Clears all the contact constraint data. This is done whenever there is a change in component structure or activity, requiring that contact information be rebuilt from scratch.

Specified by:
clearContactData in interface DeformableCollisionData

skipAuxState

public void skipAuxState(DataBuffer data)
Specified by:
skipAuxState in interface DeformableCollisionData

getAuxState

public void getAuxState(DataBuffer data,
                        CollisionData otherData)
Specified by:
getAuxState in interface DeformableCollisionData

setAuxState

public void setAuxState(DataBuffer data,
                        CollisionData other)
Specified by:
setAuxState in interface DeformableCollisionData

getInitialAuxState

public void getInitialAuxState(DataBuffer newData,
                               DataBuffer oldData)
Specified by:
getInitialAuxState in interface DeformableCollisionData

setPenetrationTol

public void setPenetrationTol(double tol)
Specified by:
setPenetrationTol in interface DeformableCollisionData

getCollisionTol

public double getCollisionTol()
Specified by:
getCollisionTol in interface DeformableCollisionData

setFriction

public void setFriction(double mu)
Specified by:
setFriction in interface DeformableCollisionData

getFriction

public double getFriction()
Specified by:
getFriction in interface DeformableCollisionData

allowCollision

public boolean allowCollision(EdgeEdgeContact eec,
                              boolean isFirst,
                              CollisionData otherData)
Specified by:
allowCollision in interface DeformableCollisionData

addConstraintInfo

public int addConstraintInfo(Vertex3d vtx,
                             Point3d pnt,
                             double weight,
                             DeformableContactConstraint con)
Description copied from interface: CollisionData
Adds the point information from this object's vertex and weight to the supplied constraint.

Specified by:
addConstraintInfo in interface CollisionData
Parameters:
vtx - vertex belonging to this object
pnt - actual world location of constraint
weight - weight used in constraint
con - the constraint to modify
Returns:
the number of constraints added or modified

reduceConstraints

public void reduceConstraints(java.util.ArrayList<ContactPenetratingPoint> myPoints,
                              java.util.ArrayList<ContactPenetratingPoint> otherPoints,
                              CollisionData otherData)
Description copied from interface: DeformableCollisionData
Culls the set of constraints to a reduced set

Specified by:
reduceConstraints in interface DeformableCollisionData
Parameters:
myPoints - list of deformable penetrating points
otherData - collision data from the other object