public class CollisionManager extends RenderableCompositeBase implements ScalableUnits, Constrainer, HasNumericState
Because collision handling can be expensive, and also because it is not as accurate as other aspects of the simulation (due largely to its discontinuous nature), it is important to be able to control very precisely how it is applied. The CollisionManager allows collision behavior to be specified through
(a) default collision behaviors between generic collidable groups, and
(b) specific behaviors between pairs of collidables which override the default behaviors.
The CollisionManager maintains:
(1) A set of default behaviors;
(2) A set of override behaviors, which are stored as invisible model components;
(3) A behavior map which describes the collision behavior for every CollidableBody in the MechModel and which is updated on demand;
(4) A set of CollisionHandlers which provides a collision handler for every active collision behavior in the behavior map and which is also updated on demand;
Collidable components can be arranged hierarchically. Any component which is a descendant of a Collidable A is known as a sub-collidable of A (a sub-collidable does not need to be an immediate child; it only need to be a descendant). Within a hierarchy, only the leaf nodes do that actual colliding, and these should be instances of the sub-interface CollidableBody.
Normally collidables within a hierarchy do not collide with each other. The
exception is when either (a) self-collision is specified for one of the
ancestor nodes in the hierarchy, or (b) an explicit collision behavior is
set between members of the hierarchy. If a self-collision behavior is
specified for an ancestor node A, and A is deformable (i.e., its
isDeformable() method returns 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.
Modifier and Type | Class and Description |
---|---|
static class |
CollisionManager.ColliderType
Specifies the collider that generates contact information between the
two meshes.
|
ModelComponent.NavpanelVisibility
CompositeComponent.NavpanelDisplay
Modifier and Type | Field and Description |
---|---|
static CollisionManager.ColliderType |
DEFAULT_COLLIDER_TYPE |
static PropertyList |
myProps |
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
TRANSPARENT, TWO_DIMENSIONAL
Constructor and Description |
---|
CollisionManager(MechModel mech) |
Modifier and Type | Method and Description |
---|---|
int |
addBilateralConstraints(SparseBlockMatrix GT,
VectorNd dg,
int numb)
Appends the current bilateral force constraint matrix
Gc^T to the
matrix GT , by appending block columns to it. |
int |
addFrictionConstraints(SparseBlockMatrix DT,
java.util.ArrayList<FrictionInfo> finfo,
boolean prune,
int numf)
Appends the friction force constraint matrix
Dc^T to the matrix
DT , by appending block columns to it. |
int |
addUnilateralConstraints(SparseBlockMatrix NT,
VectorNd dn,
int numu)
Appends the current unilateral force constraint matrix
Nc^T to the
matrix NT , by appending block columns to it. |
CollisionBehaviorList |
behaviors() |
void |
clear() |
boolean |
clearBehavior(Collidable c0,
Collidable c1)
Implements
MechModel.clearCollisionBehavior(c0,c1) . |
void |
clearBehaviors()
Implements
MechModel.clearCollisionBehaviors() . |
void |
clearCachedData() |
boolean |
clearResponse(Collidable c0,
Collidable c1)
Implements
MechModel.clearCollisionResponse(c0,c1) . |
void |
clearResponses()
Implements
MechModel.clearCollisionResponses() . |
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.
|
double |
getAcceleration()
Returns the desired collision acceleration.
|
PropertyMode |
getAccelerationMode() |
CollisionBehavior |
getActingBehavior(Collidable c0,
Collidable c1)
Implements
MechModel.getActingCollisionBehavior() . |
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
CollisionBehavior |
getBehavior(Collidable c0,
Collidable c1)
Implements
MechModel.getCollisionBehavior(c0,c1) . |
CollisionBehavior |
getBehavior(int idx) |
int |
getBilateralForces(VectorNd lam,
int idx)
Returns the bilateral forces that were most recently set for this
constrainer using
Constrainer.setBilateralForces(maspack.matrix.VectorNd, double, int) . |
int |
getBilateralInfo(MechSystem.ConstraintInfo[] ginfo,
int idx)
Returns constraint information for each row of the bilateral
constraint system
|
void |
getBilateralSizes(VectorNi sizes)
Returns the sizes of each block column in the bilateral force constraint
matrix.
|
boolean |
getBilateralVertexContact()
Returns whether bilateral constraints should be used for vertex-based
contact.
|
PropertyMode |
getBilateralVertexContactMode() |
boolean |
getBodyFaceContact()
Deprecated.
Use
getVertexPenetrations() =
VertexPenetrations.BOTH_COLLIDABLES instead. |
CollisionManager.ColliderType |
getColliderType()
Returns the collider type to be used for determining collisions.
|
PropertyMode |
getColliderTypeMode() |
double |
getCollisionArenaRadius() |
CollisionResponse |
getCollisionResponse(Collidable c0,
Collidable c1)
Implements
MechModel.getCollisionResponse(c0,c1) . |
ColorMapBase |
getColorMap() |
int |
getColorMapCollidable()
Deprecated.
Use
getRenderingCollidable() instead. |
Renderer.ColorInterpolation |
getColorMapInterpolation() |
PropertyMode |
getColorMapInterpolationMode() |
ScalarRange |
getColorMapRange() |
double |
getCompliance()
Gets the default contact compliance associated will all collision
behaviors.
|
PropertyMode |
getComplianceMode() |
void |
getConstrainedComponents(java.util.List<DynamicComponent> list)
Collected all the dynamic components constrained by this constrainer.
|
double |
getContactForceLenScale() |
double |
getContactNormalLen() |
double |
getDamping()
Gets the default contact damping associated with all collision
behaviors.
|
PropertyMode |
getDampingMode() |
CollisionBehavior |
getDefaultBehavior(Collidable.Group groupA,
Collidable.Group groupB)
Implements for
MechModel#getDefaultCollisionBehavior(groupA,groupB) ; see documentation
for that method. |
static CollisionManager.ColliderType |
getDefaultColliderType() |
double |
getDefaultContactNormalLen() |
double |
getDefaultRigidPointTol() |
double |
getDefaultRigidRegionTol() |
CollisionBehavior.ColorMapType |
getDrawColorMap() |
PropertyMode |
getDrawColorMapMode() |
boolean |
getDrawContactForces() |
PropertyMode |
getDrawContactForcesMode() |
boolean |
getDrawContactNormals() |
PropertyMode |
getDrawContactNormalsMode() |
boolean |
getDrawFrictionForces() |
PropertyMode |
getDrawFrictionForcesMode() |
boolean |
getDrawIntersectionContours() |
PropertyMode |
getDrawIntersectionContoursMode() |
boolean |
getDrawIntersectionFaces() |
PropertyMode |
getDrawIntersectionFacesMode() |
boolean |
getDrawIntersectionPoints() |
PropertyMode |
getDrawIntersectionPointsMode() |
ContactForceBehavior |
getForceBehavior() |
double |
getFriction()
Gets the Coulomb friction coefficient
|
int |
getFrictionForces(VectorNd phi,
int idx)
Returns the friction forces that were most recently set for this
constrainer using
Constrainer.setFrictionForces(maspack.matrix.VectorNd, double, int) . |
PropertyMode |
getFrictionMode() |
int |
getFrictionState(VectorNi state,
int idx) |
java.util.ArrayList<CollisionHandler> |
getHandlers() |
CollisionHandlerTable |
getHandlerTable() |
java.util.ArrayList<CollidableBody> |
getHandlerTableBodies() |
CollisionBehavior.Method |
getMethod()
Returns the contact method to be used for collisions.
|
PropertyMode |
getMethodMode() |
boolean |
getReduceConstraints()
Queries whether constraint reduction is enabled.
|
PropertyMode |
getReduceConstraintsMode() |
int |
getRenderingCollidable() |
PropertyMode |
getRenderingCollidableMode() |
boolean |
getReportNegContactForces()
Queries whether negative contact forces should be used in force
pressure maps and collision reporting.
|
PropertyMode |
getReportNegContactForcesMode() |
CollisionResponse |
getResponse(Collidable c0,
Collidable c1)
Implements
MechModel.getCollisionResponse(c0,c1) . |
CollisionResponse |
getResponse(int idx) |
double |
getRigidPointTol()
Gets the default rigid point tolerance associated with all collision
behaviors.
|
PropertyMode |
getRigidPointTolMode() |
double |
getRigidRegionTol()
Gets the default rigid region tolerance associated with all collision
behaviors.
|
PropertyMode |
getRigidRegionTolMode() |
void |
getState(DataBuffer data)
Saves state information for this component by adding data to the
supplied DataBuffer.
|
double |
getStictionCompliance()
Gets the default stiction compliance.
|
PropertyMode |
getStictionComplianceMode() |
double |
getStictionCreep()
Returns the default stiction creep.
|
PropertyMode |
getStictionCreepMode() |
double |
getStictionDamping()
Gets the default stiction damping.
|
PropertyMode |
getStictionDampingMode() |
void |
getTopCollidables(java.util.List<Collidable> list) |
int |
getUnilateralForces(VectorNd the,
int idx)
Returns the unilateral forces that were most recently set for this
constrainer using
Constrainer.setUnilateralForces(maspack.matrix.VectorNd, double, int) . |
int |
getUnilateralInfo(MechSystem.ConstraintInfo[] ninfo,
int idx)
Returns constraint information for each row of the unilateral
constraint system
|
void |
getUnilateralSizes(VectorNi sizes)
Returns the sizes of each block column in the unilateral force constraint
matrix.
|
int |
getUnilateralState(VectorNi state,
int idx) |
CollisionBehavior.VertexPenetrations |
getVertexPenetrations()
Queries when two-way contact is enabled.
|
PropertyMode |
getVertexPenetrationsMode() |
void |
initialize() |
int |
maxFrictionConstraintSets()
Returns the maximum number of friction constraint sets that can be
expected for this constraint.
|
int |
numBehaviors() |
int |
numDefaultPairs() |
int |
numResponses() |
void |
prerender(RenderList list)
Called prior to rendering to allow this object to update the internal
state required for rendering (such as by caching rendering coordinates).
|
void |
printNetContactForces() |
void |
reduceBilateralConstraints(java.util.ArrayList<ContactConstraint> bilaterals) |
void |
render(Renderer renderer,
int flags)
Render this object using the functionality of the supplied
Renderer . |
CollisionResponseList |
responses() |
void |
scaleDistance(double s)
Scales all distance coordinates.
|
void |
scaleMass(double s)
Scales all mass units.
|
void |
scan(ReaderTokenizer rtok,
java.lang.Object ref)
Scans this element from a ReaderTokenizer.
|
void |
setAcceleration(double acc)
Sets a desired acceleration for collision response which will be used to
automatically compute collision compliance if the specified compliance
(as returned by
getCompliance() ) is zero. |
void |
setAccelerationMode(PropertyMode mode) |
void |
setBehavior(Collidable c0,
Collidable c1,
CollisionBehavior behavior)
Implements
MechModel.setCollisionBehavior(c0,c1,behavior) ; see documentation for that
method. |
int |
setBilateralForces(VectorNd lam,
double s,
int idx)
Sets the bilateral forces that were computed to enforce this
constraint.
|
void |
setBilateralVertexContact(boolean enable)
Set whether bilateral constraints should be used for vertex-based
contact.
|
void |
setBilateralVertexContactMode(PropertyMode mode) |
void |
setBodyFaceContact(boolean enable)
Deprecated.
|
void |
setColliderType(CollisionManager.ColliderType ctype)
Set the collider type to be used for determining collisions.
|
void |
setColliderTypeMode(PropertyMode mode) |
void |
setCollisionArenaRadius(double rad) |
void |
setColorMap(ColorMapBase map) |
void |
setColorMapCollidable(int colNum)
Deprecated.
Use
setRenderingCollidable(int) instead. |
void |
setColorMapInterpolation(Renderer.ColorInterpolation interp) |
void |
setColorMapInterpolationMode(PropertyMode mode) |
void |
setColorMapRange(ScalarRange range) |
void |
setCompliance(double c)
Sets the default contact compliance associated with all collision
behaviors.
|
void |
setComplianceMode(PropertyMode mode) |
void |
setContactForceLenScale(double scale) |
void |
setContactNormalLen(double len) |
void |
setDamping(double d)
Sets the default contact damping associated with all collision behaviors.
|
void |
setDampingMode(PropertyMode mode) |
void |
setDefaultBehavior(Collidable.Group groupA,
Collidable.Group groupB,
CollisionBehavior behavior)
Implements
MechModel.setDefaultCollisionBehavior(groupA,groupB,behavior) ; see
documentation for that method. |
static void |
setDefaultColliderType(CollisionManager.ColliderType type) |
void |
setDrawColorMap(CollisionBehavior.ColorMapType type) |
void |
setDrawColorMapMode(PropertyMode mode) |
void |
setDrawContactForces(boolean enable) |
void |
setDrawContactForcesMode(PropertyMode mode) |
void |
setDrawContactNormals(boolean enable) |
void |
setDrawContactNormalsMode(PropertyMode mode) |
void |
setDrawFrictionForces(boolean enable) |
void |
setDrawFrictionForcesMode(PropertyMode mode) |
void |
setDrawIntersectionContours(boolean enable) |
void |
setDrawIntersectionContoursMode(PropertyMode mode) |
void |
setDrawIntersectionFaces(boolean enable) |
void |
setDrawIntersectionFacesMode(PropertyMode mode) |
void |
setDrawIntersectionPoints(boolean enable) |
void |
setDrawIntersectionPointsMode(PropertyMode mode) |
<T extends ContactForceBehavior> |
setForceBehavior(T behav) |
void |
setFriction(double mu)
Sets the Coulomb friction coefficent
|
int |
setFrictionForces(VectorNd phi,
double s,
int idx)
Sets the friction forces that were computed to enforce this
constraint.
|
void |
setFrictionMode(PropertyMode mode) |
int |
setFrictionState(VectorNi state,
int idx) |
void |
setMethod(CollisionBehavior.Method method)
Set the contact method to be used for collisions.
|
void |
setMethodMode(PropertyMode mode) |
void |
setReduceConstraints(boolean enable)
Sets whether or not constraint reduction is enabled.
|
void |
setReduceConstraintsMode(PropertyMode mode) |
void |
setRenderingCollidable(int colNum) |
void |
setRenderingCollidableMode(PropertyMode mode) |
void |
setReportNegContactForces(boolean enable)
Sets a whether negative contact forces should be used in force pressure
maps and collision reporting.
|
void |
setReportNegContactForcesMode(PropertyMode mode) |
void |
setResponse(Collidable c0,
Collidable c1,
CollisionResponse response)
Implements
MechModel.setCollisionResponse(c0,c1,response) ; see documentation for that
method. |
void |
setRigidPointTol(double tol)
Sets the default rigid point tolerance associated with all collision
behaviors.
|
void |
setRigidPointTolMode(PropertyMode mode) |
void |
setRigidRegionTol(double tol)
Sets the default rigid region tolerance associated with all collision
behaviors.
|
void |
setRigidRegionTolMode(PropertyMode mode) |
void |
setState(DataBuffer data)
Restores the state for this component by reading from the supplied
data buffer, starting at the current buffer offsets.
|
void |
setStictionCompliance(double compliance)
Sets the default stiction compliance.
|
void |
setStictionComplianceMode(PropertyMode mode) |
void |
setStictionCreep(double creep)
Sets the default stiction creep.
|
void |
setStictionCreepMode(PropertyMode mode) |
void |
setStictionDamping(double damping)
Sets the default stiction damping.
|
void |
setStictionDampingMode(PropertyMode mode) |
int |
setUnilateralForces(VectorNd the,
double s,
int idx)
Sets the unilateral forces that were computed to enforce this
constraint.
|
int |
setUnilateralState(VectorNi state,
int idx) |
void |
setVertexPenetrations(CollisionBehavior.VertexPenetrations mode)
Sets when two-way contact is enabled.
|
void |
setVertexPenetrationsMode(PropertyMode mode) |
void |
updateBounds(Vector3d pmin,
Vector3d pmax)
Update the minimum and maximum points for this object.
|
void |
updateColorMapRanges() |
double |
updateConstraints(double t,
int flags)
Updates the current set of constraints, and returns the maximum
penetration
> 0 associated with all of them. |
boolean |
use2DFrictionForBilateralContact() |
boolean |
usesBilateralConstraints()
Queries whether or not this collision manager may use bilateral
constraints given its current collision configuration.
|
void |
zeroForces()
Zeros all bilateral and unilateral constraint forces in this constraint.
|
copy, getRenderHints, getRenderProps, getSelection, isSelectable, numSelectionQueriesNeeded, setRenderProps
findComponent, get, get, getByNumber, getChildren, getNavpanelDisplay, getNumberLimit, hasChildren, hasState, hierarchyContainsReferences, indexOf, iterator, numComponents, postscan, setDisplayMode, updateNameMap
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, isFixed, isMarked, isScanning, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setScanning, setSelected, setWritable, updateReferences, write
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
advanceState, getAuxVarDerivative, getAuxVarState, getStateVersion, hasState, numAuxVars, requiresAdvance, setAuxVarState
connectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, setFixed, setMarked, setName, setNumber, setParent, setSelected, setWritable, updateReferences
getProperty
getChildren, hasChildren
postscan
isWritable, write
public static CollisionManager.ColliderType DEFAULT_COLLIDER_TYPE
public static PropertyList myProps
public CollisionManager(MechModel mech)
public static void setDefaultColliderType(CollisionManager.ColliderType type)
public static CollisionManager.ColliderType getDefaultColliderType()
public int numDefaultPairs()
public PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class ModelComponentBase
public void clear()
public double getCollisionArenaRadius()
public void setCollisionArenaRadius(double rad)
public void setContactNormalLen(double len)
public double getContactNormalLen()
public double getDefaultContactNormalLen()
public void setContactForceLenScale(double scale)
public double getContactForceLenScale()
public double getFriction()
public void setFriction(double mu)
mu
- friction coefficientpublic void setFrictionMode(PropertyMode mode)
public PropertyMode getFrictionMode()
public boolean getBilateralVertexContact()
true
if bilateral constraints should be usedpublic void setBilateralVertexContact(boolean enable)
enable
- if true
, enables bilateral constraintspublic void setBilateralVertexContactMode(PropertyMode mode)
public PropertyMode getBilateralVertexContactMode()
public double getRigidRegionTol()
public void setRigidRegionTol(double tol)
tol
- new rigid region tolerancepublic void setRigidRegionTolMode(PropertyMode mode)
public PropertyMode getRigidRegionTolMode()
public double getDefaultRigidRegionTol()
public double getRigidPointTol()
public void setRigidPointTol(double tol)
tol
- new rigid point tolerancepublic void setRigidPointTolMode(PropertyMode mode)
public PropertyMode getRigidPointTolMode()
public double getDefaultRigidPointTol()
public boolean getReduceConstraints()
public void setReduceConstraints(boolean enable)
enable
- true if constraint reduction should be enabledpublic void setReduceConstraintsMode(PropertyMode mode)
public PropertyMode getReduceConstraintsMode()
public boolean getBodyFaceContact()
getVertexPenetrations()
=
VertexPenetrations.BOTH_COLLIDABLES
instead.public void setBodyFaceContact(boolean enable)
setVertexPenetrations(artisynth.core.mechmodels.CollisionBehavior.VertexPenetrations)
instead.public CollisionBehavior.VertexPenetrations getVertexPenetrations()
CollisionBehavior.VertexPenetrations
for
details.public void setVertexPenetrations(CollisionBehavior.VertexPenetrations mode)
CollisionBehavior.VertexPenetrations
for
details.mode
- specifies when two-way contact is enabled.public void setVertexPenetrationsMode(PropertyMode mode)
public PropertyMode getVertexPenetrationsMode()
public double getCompliance()
public void setCompliance(double c)
c
- new contact compliancepublic void setComplianceMode(PropertyMode mode)
public PropertyMode getComplianceMode()
public double getDamping()
public void setDamping(double d)
d
- new contact dampingpublic void setDampingMode(PropertyMode mode)
public PropertyMode getDampingMode()
public double getStictionCreep()
setStictionCreep(double)
.public void setStictionCreep(double creep)
> 0
regularizes the
computation of friction forces by removing redundancy.
Creep values can be specified for individual collidable pairs by
setting the stictionCreep
property of their associated CollisionBehavior
.
creep
- new stiction creeppublic void setStictionCreepMode(PropertyMode mode)
public PropertyMode getStictionCreepMode()
public double getStictionCompliance()
setStictionCompliance(double)
.public void setStictionCompliance(double compliance)
compliance
- new stiction compliancepublic void setStictionComplianceMode(PropertyMode mode)
public PropertyMode getStictionComplianceMode()
public double getStictionDamping()
setStictionDamping(double)
.public void setStictionDamping(double damping)
damping
- new stiction dampingpublic void setStictionDampingMode(PropertyMode mode)
public PropertyMode getStictionDampingMode()
public double getAcceleration()
setAcceleration(double)
.public void setAcceleration(double acc)
getCompliance()
) is zero.
This property is currently experimental and not guaranteed to produce reliable results.
acc
- desired collision accelerationpublic void setAccelerationMode(PropertyMode mode)
public PropertyMode getAccelerationMode()
public boolean getReportNegContactForces()
true
if negative contact forces being shownpublic void setReportNegContactForces(boolean enable)
enable
- if true
, enables showing negative contact forcespublic void setReportNegContactForcesMode(PropertyMode mode)
public PropertyMode getReportNegContactForcesMode()
public boolean getDrawIntersectionContours()
public void setDrawIntersectionContours(boolean enable)
public void setDrawIntersectionContoursMode(PropertyMode mode)
public PropertyMode getDrawIntersectionContoursMode()
public boolean getDrawIntersectionFaces()
public void setDrawIntersectionFaces(boolean enable)
public void setDrawIntersectionFacesMode(PropertyMode mode)
public PropertyMode getDrawIntersectionFacesMode()
public boolean getDrawIntersectionPoints()
public void setDrawIntersectionPoints(boolean enable)
public void setDrawIntersectionPointsMode(PropertyMode mode)
public PropertyMode getDrawIntersectionPointsMode()
public boolean getDrawContactNormals()
public void setDrawContactNormals(boolean enable)
public void setDrawContactNormalsMode(PropertyMode mode)
public PropertyMode getDrawContactNormalsMode()
public boolean getDrawContactForces()
public void setDrawContactForces(boolean enable)
public void setDrawContactForcesMode(PropertyMode mode)
public PropertyMode getDrawContactForcesMode()
public boolean getDrawFrictionForces()
public void setDrawFrictionForces(boolean enable)
public void setDrawFrictionForcesMode(PropertyMode mode)
public PropertyMode getDrawFrictionForcesMode()
public void setColorMapInterpolation(Renderer.ColorInterpolation interp)
public Renderer.ColorInterpolation getColorMapInterpolation()
public void setColorMapInterpolationMode(PropertyMode mode)
public PropertyMode getColorMapInterpolationMode()
public CollisionBehavior.ColorMapType getDrawColorMap()
public void setDrawColorMap(CollisionBehavior.ColorMapType type)
public void setDrawColorMapMode(PropertyMode mode)
public PropertyMode getDrawColorMapMode()
public int getRenderingCollidable()
public void setRenderingCollidable(int colNum)
public void setRenderingCollidableMode(PropertyMode mode)
public PropertyMode getRenderingCollidableMode()
public int getColorMapCollidable()
getRenderingCollidable()
instead.public void setColorMapCollidable(int colNum)
setRenderingCollidable(int)
instead.public void setColorMap(ColorMapBase map)
public ColorMapBase getColorMap()
public void setColorMapRange(ScalarRange range)
public ScalarRange getColorMapRange()
public <T extends ContactForceBehavior> void setForceBehavior(T behav)
public ContactForceBehavior getForceBehavior()
public CollisionBehavior.Method getMethod()
public void setMethod(CollisionBehavior.Method method)
CollisionBehavior.Method.DEFAULT
, which means that the method will be determined
based on the colliding bodies.method
- contact method to be usedpublic void setMethodMode(PropertyMode mode)
public PropertyMode getMethodMode()
public CollisionManager.ColliderType getColliderType()
public void setColliderType(CollisionManager.ColliderType ctype)
ctype
- type new collider typepublic void setColliderTypeMode(PropertyMode mode)
public PropertyMode getColliderTypeMode()
public CollisionBehaviorList behaviors()
public int numBehaviors()
public CollisionBehavior getBehavior(int idx)
public CollisionResponseList responses()
public int numResponses()
public CollisionResponse getResponse(int idx)
public void setDefaultBehavior(Collidable.Group groupA, Collidable.Group groupB, CollisionBehavior behavior)
MechModel.setDefaultCollisionBehavior(groupA,groupB,behavior)
; see
documentation for that method.groupA
- first generic collidable groupgroupB
- second generic collidable groupbehavior
- desired collision behaviorpublic CollisionBehavior getDefaultBehavior(Collidable.Group groupA, Collidable.Group groupB)
MechModel#getDefaultCollisionBehavior(groupA,groupB)
; see documentation
for that method.groupA
- first generic collidable groupgroupB
- second generic collidable grouppublic void setBehavior(Collidable c0, Collidable c1, CollisionBehavior behavior)
MechModel.setCollisionBehavior(c0,c1,behavior)
; see documentation for that
method.c0
- first collidablec1
- second collidablebehavior
- desired collision behaviorpublic CollisionBehavior getBehavior(Collidable c0, Collidable c1)
MechModel.getCollisionBehavior(c0,c1)
. See documentation for that method.c0
- first collidablec1
- second collidablepublic boolean clearBehavior(Collidable c0, Collidable c1)
MechModel.clearCollisionBehavior(c0,c1)
. See documentation for that method.c0
- first collidablec1
- second collidabletrue
if the specific behavior had been set
and was removed for the indicated collidable pair.public void clearBehaviors()
MechModel.clearCollisionBehaviors()
. See documentation for that method.public void setResponse(Collidable c0, Collidable c1, CollisionResponse response)
MechModel.setCollisionResponse(c0,c1,response)
; see documentation for that
method.c0
- first collidablec1
- second collidableresponse
- desired collision responsepublic CollisionResponse getResponse(Collidable c0, Collidable c1)
MechModel.getCollisionResponse(c0,c1)
. See documentation for that method.c0
- first collidablec1
- second collidablepublic boolean clearResponse(Collidable c0, Collidable c1)
MechModel.clearCollisionResponse(c0,c1)
. See documentation for that method.c0
- first collidablec1
- second collidabletrue
if the specific response had been set
and was removed for the indicated collidable pair.public void clearResponses()
MechModel.clearCollisionResponses()
. See documentation for that method.public void getTopCollidables(java.util.List<Collidable> list)
public CollisionHandlerTable getHandlerTable()
public java.util.ArrayList<CollisionHandler> getHandlers()
public java.util.ArrayList<CollidableBody> getHandlerTableBodies()
public CollisionBehavior getActingBehavior(Collidable c0, Collidable c1)
MechModel.getActingCollisionBehavior()
.
See documentation for that method.c0
- first collidablec1
- second collidablenull
if no common behavior is found.public CollisionResponse getCollisionResponse(Collidable c0, Collidable c1)
MechModel.getCollisionResponse(c0,c1)
.
See documentation for that method.c0
- first collidable. Must be a specific collidable.c1
- second collidable(s). May be a specific collidable
or a colliable group.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 initialize()
public void clearCachedData()
public void scan(ReaderTokenizer rtok, java.lang.Object ref) throws java.io.IOException
write
.scan
in interface ModelComponent
scan
in interface Scannable
scan
in class CompositeComponentBase
rtok
- Tokenizer from which to scan the elementref
- optional reference object which can be used for resolving references to
other objectsjava.io.IOException
- if an I/O or formatting error occuredpublic 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 reduceBilateralConstraints(java.util.ArrayList<ContactConstraint> bilaterals)
public double updateConstraints(double t, int flags)
Constrainer
>
0 associated with all of them. If no constraints are
presently active, returns -1.updateConstraints
in interface Constrainer
public void getBilateralSizes(VectorNi sizes)
Constrainer
sizes
.getBilateralSizes
in interface Constrainer
sizes
- vector to which the block column sizes are appendedpublic int addBilateralConstraints(SparseBlockMatrix GT, VectorNd dg, int numb)
Constrainer
Gc^T
to the
matrix GT
, by appending block columns to it. If the argument
dg
is non-null
, it should be used to return the
velocity constraint time derivative, defined by
\dot Gc velstarting at the location
numb
. In all cases, the method must
return an updated value of numb
, incremented by the total row
size of Gc
.addBilateralConstraints
in interface Constrainer
GT
- matrix to which the bilateral force contraint matrix
is appended.dg
- if non-null
, returns the velocity constraint time
derivativenumb
- starting index for time derivative in dg
numb
public int getBilateralInfo(MechSystem.ConstraintInfo[] ginfo, int idx)
Constrainer
Gc vel = 0.This information is placed in pre-allocated
MechSystem.ConstraintInfo
structures in ginfo
, starting at idx
. The method must
return an updated value of idx
, incremented by the number of
rows of Gc
.
The constraint information to be set in ConstraintInfo
includes:
dist // distance to the constraint surface. compliance // if > 0, gives constraint compliance value damping // damping; only used if compliance > 0 force // used for computing non-linear compliance
getBilateralInfo
in interface Constrainer
ginfo
- returns the constraint informationidx
- starting location in ginfo
for returning constraint
infoidx
public int setBilateralForces(VectorNd lam, double s, int idx)
Constrainer
lam
, starting at the index idx
, and should be
scaled by s
. (In practice, s
is used to convert from
impulses to forces.) The method must return an updated value of idx
, incremented by the number of forces associated with this constraint.setBilateralForces
in interface Constrainer
lam
- supplies the force impulses, which should be scaled by s
s
- scaling factor for the force valuesidx
- starting index of forces in lam
idx
public int getBilateralForces(VectorNd lam, int idx)
Constrainer
Constrainer.setBilateralForces(maspack.matrix.VectorNd, double, int)
. The forces are returned in
lam
, starting at the index idx
. The method must return
an updated value of idx
, incremented by the number of forces
associated with this constraint.getBilateralForces
in interface Constrainer
lam
- returns the forcesidx
- starting index for forces in lam
idx
public void zeroForces()
Constrainer
zeroForces
in interface Constrainer
public void getUnilateralSizes(VectorNi sizes)
Constrainer
sizes
.getUnilateralSizes
in interface Constrainer
sizes
- vector to which the block column sizes are appendedpublic int addUnilateralConstraints(SparseBlockMatrix NT, VectorNd dn, int numu)
Constrainer
Nc^T
to the
matrix NT
, by appending block columns to it. If the argument
dn
is non-null
, it should be used to return the
velocity constraint time derivative, defined by
\dot Nc velstarting at the location
numu
. In all cases, the method must
return an updated value of numu
, incremented by the total row
size of Nc
.addUnilateralConstraints
in interface Constrainer
NT
- matrix to which the unilateral force contraint matrix
is appended.dn
- if non-null
, returns the velocity constraint time
derivativenumu
- starting index for time derivative in dn
numu
public int getUnilateralInfo(MechSystem.ConstraintInfo[] ninfo, int idx)
Constrainer
Nc vel > 0.This information is placed in pre-allocated
MechSystem.ConstraintInfo
structures in ninfo
, starting at idx
. The method must
return an updated value of idx
, incremented by the number of
rows of Nc
.
The constraint information to be set in ConstraintInfo
includes:
dist // distance to the constraint surface. compliance // if > 0, gives constraint compliance value damping // damping; only used if compliance > 0 force // used for computing non-linear compliance
getUnilateralInfo
in interface Constrainer
ninfo
- returns the constraint informationidx
- starting location in ninfo
for returning constraint
infoidx
public int setUnilateralForces(VectorNd the, double s, int idx)
Constrainer
the
, starting at the index idx
, and should be
scaled by s
. (In practice, s
is used to convert from
impulses to forces.) The method must return an updated value of idx
, incremented by the number of forces associated with this constraint.setUnilateralForces
in interface Constrainer
the
- supplies the force impulses, which should be scaled by s
s
- scaling factor for the force valuesidx
- starting index of forces in the
idx
public int getUnilateralForces(VectorNd the, int idx)
Constrainer
Constrainer.setUnilateralForces(maspack.matrix.VectorNd, double, int)
. The forces are returned in
the
, starting at the index idx
. The method must return
an updated value of idx
, incremented by the number of forces
associated with this constraint.getUnilateralForces
in interface Constrainer
the
- returns the forcesidx
- starting index for forces in the
idx
public int setUnilateralState(VectorNi state, int idx)
setUnilateralState
in interface Constrainer
public int getUnilateralState(VectorNi state, int idx)
getUnilateralState
in interface Constrainer
public int maxFrictionConstraintSets()
Constrainer
finfo
argument that is
passed to Constrainer.addFrictionConstraints(maspack.matrix.SparseBlockMatrix, java.util.ArrayList<maspack.spatialmotion.FrictionInfo>, boolean, int)
.maxFrictionConstraintSets
in interface Constrainer
public int addFrictionConstraints(SparseBlockMatrix DT, java.util.ArrayList<FrictionInfo> finfo, boolean prune, int numf)
Constrainer
Dc^T
to the matrix
DT
, by appending block columns to it. Each block column in Dc^T
corresponds to a friction constraint set, for which
information should be supplied in the pre-allocated FrictionInfo
structures in finfo
, starting at idx
. The method must
return an updated value of idx
, incremented by the number of
friction constraint sets.addFrictionConstraints
in interface Constrainer
DT
- matrix to which the friction force contraint matrix
is appended.finfo
- returns friction constraint information for each
block column in Dc^T
prune
- restrict entries of DT to friction constraints
for which the contact force is > 0
.numf
- starting index for friction information in finfo
idx
public int setFrictionForces(VectorNd phi, double s, int idx)
phi
, starting at the index idx
, and should be
scaled by s
. (In practice, s
is used to convert from
impulses to forces.) The method must return an updated value of idx
, incremented by the number of forces associated with this constraint.setFrictionForces
in interface Constrainer
phi
- supplies the force impulses, which should be scaled by s
s
- scaling factor for the force valuesidx
- starting index of forces in phi
idx
public int getFrictionForces(VectorNd phi, int idx)
Constrainer.setFrictionForces(maspack.matrix.VectorNd, double, int)
. The forces are returned in
phi
, starting at the index idx
. The method must return
an updated value of idx
, incremented by the number of forces
associated with this constraint.getFrictionForces
in interface Constrainer
phi
- returns the forcesidx
- starting index for forces in phi
idx
public int setFrictionState(VectorNi state, int idx)
setFrictionState
in interface Constrainer
public int getFrictionState(VectorNi state, int idx)
getFrictionState
in interface Constrainer
public void printNetContactForces()
public void getConstrainedComponents(java.util.List<DynamicComponent> list)
Constrainer
getConstrainedComponents
in interface Constrainer
list
- list to which constrained components should be appendedpublic boolean usesBilateralConstraints()
true
if this collision manager may use bilateral
constraintspublic RenderProps createRenderProps()
HasRenderProps
createRenderProps
in interface HasRenderProps
createRenderProps
in class RenderableCompositeBase
public void updateBounds(Vector3d pmin, Vector3d pmax)
IsRenderable
updateBounds
in interface IsRenderable
updateBounds
in class RenderableCompositeBase
pmin
- minimum pointpmax
- maximum pointpublic void updateColorMapRanges()
public void prerender(RenderList list)
IsRenderable
list.addIfVisible (obj);
for each of the objects in question.prerender
in interface IsRenderable
prerender
in class RenderableCompositeBase
list
- list of objects to be renderedpublic void render(Renderer renderer, int flags)
IsRenderable
Renderer
.render
in interface IsRenderable
render
in class RenderableCompositeBase
renderer
- provides the functionality used to perform the rendering.flags
- flags that may be used to control different
aspects of the rendering. Flags are defined in Renderer
and currently include
Renderer.HIGHLIGHT
and
Renderer.SORT_FACES
.public void getState(DataBuffer data)
HasNumericState
getState
in interface HasNumericState
data
- buffer for storing the state values.public void setState(DataBuffer data)
HasNumericState
setState
in interface HasNumericState
data
- buffer containing the state informationpublic boolean use2DFrictionForBilateralContact()