public class CollisionManager extends RenderableCompositeBase implements ScalableUnits, Constrainer
true
), then that behavior will be
passed on to all pairs of sub-collidables of A for which A's method
allowSelfCollisions() returns true.
When a collision behavior is specified between two collidables A and B that
are *not* part of the same hierarchy, then that behavior is imparted to all
pairs of leaf-nodes located at or below A and B.ModelComponent.NavpanelVisibility
CompositeComponent.NavpanelDisplay
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_REDUCE_CONSTRAINTS |
static PropertyList |
myProps |
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
TRANSLUCENT, TWO_DIMENSIONAL
Constructor and Description |
---|
CollisionManager(MechModel mech)
Create a collision manager for a specific mech system.
|
Modifier and Type | Method and Description |
---|---|
int |
addBilateralConstraints(SparseBlockMatrix GT,
VectorNd dg,
int numb) |
int |
addFrictionConstraints(SparseBlockMatrix DT,
MechSystem.FrictionInfo[] finfo,
int numf) |
int |
addUnilateralConstraints(SparseBlockMatrix NT,
VectorNd dn,
int numu) |
void |
clear() |
void |
clearCachedData() |
boolean |
clearCollisionBehavior(Collidable a,
Collidable b)
Clears any collision behavior that has been defined for a specified
pair of Collidables to override the primary behavior.
|
void |
clearCollisionBehaviors()
Clears any collision behaviors that have been defined to override
the default collision behaviors betweem pairs of Collidables.
|
ComponentList<CollisionComponent> |
collisionComponents() |
CollisionHandlerList |
collisionHandlers()
If necessary, rebuilds the collison pair list from the specified
contact info.
|
void |
componentChanged(ComponentChangeEvent e)
Notifies this composite component that a change has occured within one or
more of its descendants.
|
RenderProps |
createRenderProps()
Factory method to create render properties appropriate to this object.
|
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
CollisionBehavior |
getBehavior(Collidable a,
Collidable b)
Returns the collision behavior for a specified pair of collidables.
|
int |
getBilateralImpulses(VectorNd lam,
int idx) |
int |
getBilateralInfo(MechSystem.ConstraintInfo[] ginfo,
int idx) |
void |
getBilateralSizes(VectorNi sizes) |
double |
getCollisionAccel() |
double |
getCollisionArenaRadius() |
double |
getCollisionCompliance() |
CollisionComponent |
getCollisionComponent(CollidablePair pair)
Returns the CollisionCompenent in this model associated with
a particular collision override.
|
double |
getCollisionDamping() |
CollisionHandler |
getCollisionHandler(CollidableBody colA,
CollidableBody colB)
Returns the collision handler for a specific pair of CollidableBodys, or
null if no collisions are enabled for that pair. |
double |
getCollisionPointTol() |
double |
getCollisionRegionTol() |
java.util.Map<Vertex3d,Vector3d> |
getContactImpulses(CollidableBody colA,
CollidableBody colB)
Returns a map specifying the contact impulses acting on the
CollidableBody
colA in response to contact with another
CollidableBody colB . |
double |
getContactNormalLen() |
CollisionBehavior |
getDefaultCollisionBehavior(Collidable typeA,
Collidable typeB)
Gets the default collision behavior for a specified pair of generic
collidable types.
|
static double |
getDefaultPenetrationTol(ModelComponent comp,
double defaultTol) |
double |
getPenetrationTol() |
PropertyMode |
getPenetrationTolMode() |
boolean |
getReduceConstraints() |
int |
getUnilateralImpulses(VectorNd the,
int idx) |
int |
getUnilateralInfo(MechSystem.ConstraintInfo[] ninfo,
int idx) |
void |
getUnilateralSizes(VectorNi sizes) |
void |
initialize() |
boolean |
isDrawIntersectionContours() |
boolean |
isDrawIntersectionFaces() |
boolean |
isDrawIntersectionPoints() |
int |
maxFrictionConstraintSets() |
void |
prerender(RenderList list)
Prepare for rendering, and potentially add itself to a list to be drawn
by a GLRenderer.
|
void |
reduceBilateralConstraints() |
void |
render(GLRenderer renderer,
int flags)
Render this object using Open GL via the JOGL.
|
void |
scaleDistance(double s)
Scales all distance coordinates.
|
void |
scaleMass(double s)
Scales all mass units.
|
void |
setBehavior(Collidable a,
Collidable b,
CollisionBehavior behavior)
Sets collision behavior for a specified pair of Collidables, overriding,
if necessary, the primary behavior.
|
void |
setBehavior(CollidablePair pair,
CollisionBehavior behavior) |
int |
setBilateralImpulses(VectorNd lam,
double h,
int idx) |
void |
setCollisionAccel(double acc) |
void |
setCollisionArenaRadius(double rad) |
void |
setCollisionCompliance(double c) |
void |
setCollisionDamping(double d) |
void |
setCollisionPointTol(double tol) |
void |
setCollisionRegionTol(double tol) |
void |
setContactNormalLen(double len) |
void |
setDefaultBehavior(Collidable typeA,
Collidable typeB,
CollisionBehavior behavior)
Sets the default collision behavior for a specified pair of generic
collidable types.
|
void |
setDefaultBehavior(CollisionBehavior behavior)
Specifies the default collision behavior for all default pairs
(RigidBody-RigidBody, RigidBody-Deformable, Deformable-Deformable,
Deformable-Self).
|
void |
setDrawIntersectionContours(boolean set) |
void |
setDrawIntersectionFaces(boolean set) |
void |
setDrawIntersectionPoints(boolean set) |
void |
setFriction(double mu) |
void |
setPenetrationTol(double tol)
Sets the penetration tolerance for this component.
|
void |
setPenetrationTolMode(PropertyMode mode) |
void |
setReduceConstraints(boolean set) |
int |
setUnilateralImpulses(VectorNd the,
double h,
int idx) |
void |
updateBounds(Point3d pmin,
Point3d pmax)
Update the minimum and maximum points for this object.
|
double |
updateConstraints(double t,
int flags) |
void |
zeroImpulses() |
copy, getRenderHints, getRenderProps, getSelection, isSelectable, numSelectionQueriesNeeded, setRenderProps
findComponent, get, get, getByNumber, getChildren, getNavpanelDisplay, getNumberLimit, hasChildren, hasState, hierarchyContainsReferences, indexOf, iterator, numComponents, postscan, scan, setDisplayMode, updateNameMap
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, isConnectedToHierarchy, isFixed, isMarked, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setSelected, updateReferences, write
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
connectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, postscan, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, updateReferences
getProperty
getChildren, hasChildren
isWritable, write
public static boolean DEFAULT_REDUCE_CONSTRAINTS
public static PropertyList myProps
public CollisionManager(MechModel mech)
public PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class ModelComponentBase
public void setPenetrationTol(double tol)
tol
- new penetration tolerancepublic double getPenetrationTol()
public PropertyMode getPenetrationTolMode()
public void setPenetrationTolMode(PropertyMode mode)
public static double getDefaultPenetrationTol(ModelComponent comp, double defaultTol)
public double getCollisionArenaRadius()
public void setCollisionArenaRadius(double rad)
public void setCollisionPointTol(double tol)
public double getCollisionPointTol()
public void setCollisionRegionTol(double tol)
public double getCollisionRegionTol()
public void setContactNormalLen(double len)
public double getContactNormalLen()
public void setCollisionCompliance(double c)
public double getCollisionCompliance()
public void setCollisionDamping(double d)
public double getCollisionDamping()
public double getCollisionAccel()
public void setCollisionAccel(double acc)
public void clear()
public void setFriction(double mu)
public void setDefaultBehavior(CollisionBehavior behavior)
behavior
- desired collision behaviorpublic CollisionBehavior getDefaultCollisionBehavior(Collidable typeA, Collidable typeB)
MechModel#getDefaultCollisionBehavior(typeA,typeB)
.typeA
- first generic collidable typetypeB
- second generic collidable typepublic void setDefaultBehavior(Collidable typeA, Collidable typeB, CollisionBehavior behavior)
MechModel.setDefaultCollisionBehavior(typeA,typeB,behavior)
.typeA
- first generic collidable typetypeB
- second generic collidable typebehavior
- specified collision behaviorpublic void setBehavior(Collidable a, Collidable b, CollisionBehavior behavior)
MechModel.setCollisionBehavior(a,b,behavior)
.a
- first Collidableb
- second Collidablebehavior
- specified collision behaviorpublic boolean clearCollisionBehavior(Collidable a, Collidable b)
MechModel.clearCollisionBehavior(a,b)
.a
- first Collidableb
- second Collidabletrue
if an override behavior was specified
and removed for the indicated collidables.public void clearCollisionBehaviors()
MechModel.clearCollisionBehaviors()
.public CollisionComponent getCollisionComponent(CollidablePair pair)
null
is returned. This method is provided mostly for
internal ArtiSynth use.pair
- collidable pairpublic CollisionBehavior getBehavior(Collidable a, Collidable b)
MechModel.getCollisionBehavior(a,b)
.a
- first Collidableb
- second Collidablepublic void setBehavior(CollidablePair pair, CollisionBehavior behavior)
public CollisionHandlerList collisionHandlers()
public CollisionHandler getCollisionHandler(CollidableBody colA, CollidableBody colB)
null
if no collisions are enabled for that pair. The query
is symmetric, so that getCollisionHandler(A,B)
and
getCollisionHandler(B,A)
will return the same value.
Note that collision handlers are currently regenerated whenever the set of enabled collisions between objects changes. Any handler returned by this method prior to such a change will then become invalid.
colA
- first collidablecolB
- second collidablepublic java.util.Map<Vertex3d,Vector3d> getContactImpulses(CollidableBody colA, CollidableBody colB)
colA
in response to contact with another
CollidableBody colB
. This method currently requires that
colA
is a deformable body. If it is not, or if no collisions
are enabled between colA
and colB
, then
null
is returned.
The map gives the most recently computed impulses acting on each
vertex of the collision mesh of colA
(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.
colA
- first collidablecolB
- second collidablecolA
in response to colB
.public ComponentList<CollisionComponent> collisionComponents()
public void initialize()
public RenderProps createRenderProps()
HasRenderProps
createRenderProps
in interface HasRenderProps
createRenderProps
in class RenderableCompositeBase
public void updateBounds(Point3d pmin, Point3d pmax)
GLRenderable
updateBounds
in interface GLRenderable
updateBounds
in class RenderableCompositeBase
pmin
- minimum pointpmax
- maximum pointpublic void prerender(RenderList list)
GLRenderable
prerender
in interface GLRenderable
prerender
in class RenderableCompositeBase
public void render(GLRenderer renderer, int flags)
GLRenderable
render
in interface GLRenderable
render
in class RenderableCompositeBase
renderer
- renderer object which is used to perform the rendering. Provides pointers
to GL and GLU, along with helper functions.flags
- supplies flags that may be used to control different
aspects of the rendering. Flags are defined in GLRenderer
and currently include
GLRenderer.SELECTED
,
GLRenderer.VERTEX_COLORING
,
GLRenderer.HSV_COLOR_INTERPOLATION
,
GLRenderer.SORT_FACES
, and
GLRenderer.CLEAR_MESH_DISPLAY_LISTS
.public void scaleDistance(double s)
ScalableUnits
scaleDistance
in interface ScalableUnits
s
- scaling factorpublic void scaleMass(double s)
ScalableUnits
scaleMass
in interface ScalableUnits
s
- scaling factorpublic void clearCachedData()
public void componentChanged(ComponentChangeEvent e)
CompositeComponentBase
This method should propagate the notification up the component hierarchy
by calling notifyParentOfChange
.
componentChanged
in interface ComponentChangeListener
componentChanged
in interface CompositeComponent
componentChanged
in class CompositeComponentBase
e
- optional argument giving specific information about the changepublic void setDrawIntersectionContours(boolean set)
public boolean isDrawIntersectionContours()
public void setDrawIntersectionFaces(boolean set)
public boolean isDrawIntersectionFaces()
public void setDrawIntersectionPoints(boolean set)
public boolean isDrawIntersectionPoints()
public void setReduceConstraints(boolean set)
public boolean getReduceConstraints()
public void getBilateralSizes(VectorNi sizes)
getBilateralSizes
in interface Constrainer
public int addBilateralConstraints(SparseBlockMatrix GT, VectorNd dg, int numb)
addBilateralConstraints
in interface Constrainer
public int getBilateralInfo(MechSystem.ConstraintInfo[] ginfo, int idx)
getBilateralInfo
in interface Constrainer
public int setBilateralImpulses(VectorNd lam, double h, int idx)
setBilateralImpulses
in interface Constrainer
public int getBilateralImpulses(VectorNd lam, int idx)
getBilateralImpulses
in interface Constrainer
public void zeroImpulses()
zeroImpulses
in interface Constrainer
public void getUnilateralSizes(VectorNi sizes)
getUnilateralSizes
in interface Constrainer
public int addUnilateralConstraints(SparseBlockMatrix NT, VectorNd dn, int numu)
addUnilateralConstraints
in interface Constrainer
public int getUnilateralInfo(MechSystem.ConstraintInfo[] ninfo, int idx)
getUnilateralInfo
in interface Constrainer
public int setUnilateralImpulses(VectorNd the, double h, int idx)
setUnilateralImpulses
in interface Constrainer
public int getUnilateralImpulses(VectorNd the, int idx)
getUnilateralImpulses
in interface Constrainer
public int maxFrictionConstraintSets()
maxFrictionConstraintSets
in interface Constrainer
public int addFrictionConstraints(SparseBlockMatrix DT, MechSystem.FrictionInfo[] finfo, int numf)
addFrictionConstraints
in interface Constrainer
public void reduceBilateralConstraints()
public double updateConstraints(double t, int flags)
updateConstraints
in interface Constrainer