public class CollisionResponse extends CollisionComponent
ModelComponent.NavpanelVisibility
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, myProps, NULL_OBJ, useCompactPathNames
Constructor and Description |
---|
CollisionResponse() |
Modifier and Type | Method and Description |
---|---|
double |
getContactArea(int cidx)
Returns the total collision contact area associated with either the first
or second collidable (as indicated by
cidx ). |
java.util.Map<Vertex3d,Vector3d> |
getContactImpulses(int cidx)
Returns a map specifying the contact impulses acting on all the deformable
bodies associated with either the first or second collidable (as indicated
by
cidx ). |
java.util.ArrayList<CollisionHandler> |
getHandlers()
Returns the CollisionHandlers for all currently active collisions
associated with the collidables of this response.
|
java.util.ArrayList<PenetrationRegion> |
getPenetrationRegions(int cidx)
Returns the PenetrationRegions on all bodies associated with either the
first or second collidable (as indicated by
cidx ) resulting
from contact with the other collidable. |
boolean |
inContact()
Queries if the collidables associated with this response are in
contact.
|
getCollidable, getCollidablePair, getHardReferences, setCollidablePair, setCollidablePair
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, copy, createTempFlag, disconnectFromHierarchy, getAllPropertyInfo, getChildren, getGrandParent, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, hasChildren, hasState, isConnectedToHierarchy, isFixed, isMarked, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, postscan, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, scan, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setSelected, updateReferences, write
public boolean inContact()
true
if the collidables are in contact.public java.util.Map<Vertex3d,Vector3d> getContactImpulses(int cidx)
cidx
).
The map gives the most recently computed impulses acting on each vertex of
the collision meshes of the deformable bodies (this is the same mesh
returned by CollidableBody.getCollisionMesh()
). Vertices for which
no impulses were computed do not appear in the map. To turn the impulses
into forces, one must divide by the current step size.
Contact impulses give the forces that arise in order to prevent further
interpenetration between colA
and colB
. They do
not include impulses that are computed to separate
colA
and colB
when they initially come into
contact.
cidx
- collidable index - 0 for first, 1 for secondpublic java.util.ArrayList<PenetrationRegion> getPenetrationRegions(int cidx)
cidx
) resulting
from contact with the other collidable. In order for penetration regions
to be available, collisions must be performed with the collider type set
to ColliderType.AJL_CONTOUR
. If penetrations regions are not available,
null
is returned.cidx
- collidable index - 0 for first, 1 for secondpublic double getContactArea(int cidx)
cidx
). In order for
this to be determined, collisions must be performed with the collider type
set to ColliderType.AJL_CONTOUR
. If this is not the case, -1 is returned.cidx
- collidable index - 0 for first, 1 for secondpublic java.util.ArrayList<CollisionHandler> getHandlers()
Each collision handler is associated with two collidable bodies.
However, the pairwise ordering of these bodies may not correspond
to the ordering of the collidables associated with this
response. In other words, the first and second bodies the
handler may be associated with the second and first collidables.
To test this, one may use the method CollisionHandler.getBodyIndex(artisynth.core.mechmodels.Collidable)
to query whether one of this
response's collidables is associated with the first or second
handler body. For example, to test the first collidable, one
would call
if (handler.getBodyIndex(getCollidable(0)) == 0) { // pairwise ordering corresponds } else { // pairwise ordering is reversed }