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.List<ContactData> |
getContactData()
Returns a list of the most recently computed contacts between the
collidables.
|
java.util.Map<Vertex3d,Vector3d> |
getContactForces(int cidx)
Returns a map of the most recenty computed contact forces acting on the
vertices of the collision meshes associated with either the first or
second collidable (as indicated by
cidx ). |
java.util.Map<Vertex3d,java.lang.Double> |
getContactPressures(int cidx)
Returns a map of the most recenty computed contact pressures acting on
the vertices of the collision meshes 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, isFixed, isMarked, isScanning, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, postscan, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, scan, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setScanning, setSelected, setWritable, updateReferences, write
public boolean inContact()
CollisionBehavior.Method
), it is possible for meshes to
interesect in a small region without having any penetrating vertices.true
if the collidables are in contact.public java.util.List<ContactData> getContactData()
ContactData
object providing information about the contact points (on each
collidable), the normal, and contact and friction forces.public java.util.Map<Vertex3d,Vector3d> getContactForces(int cidx)
cidx
). Vertices for
which no forces were computed do not appear in the map. The information
returned by this method is most useful and accurate when used in
conjunction with vertex penetration collisions (see CollisionBehavior.Method
).
The meshes containing the vertices can be obtained using the CollidableBody.getCollisionMesh()
method of the indicated collidable
and/or its sub-collidables.
Contact forces are those that arise in order to prevent further
interpenetration between colA
and colB
. They do
not include forces 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.Map<Vertex3d,java.lang.Double> getContactPressures(int cidx)
cidx
). Vertices for
which no pressures were computed do not appear in the map. The information
returned by this method is most useful and accurate when used in
conjunction with vertex penetration collisions (see CollisionBehavior.Method
).
The meshes containing the vertices can be obtained using the CollidableBody.getCollisionMesh()
method of the indicated collidable
and/or its sub-collidables.
This method works by first calling getContactForces(int)
to
obtain the vertex forces, and then converting these to pressures by
dividing the force magnitude at each vertex by 1/3 of the area of all the
faces surrounding that vertex.
public 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 }