public class CollisionBehavior extends CollisionComponent implements Renderable
Modifier and Type | Class and Description |
---|---|
static class |
CollisionBehavior.ColorMapType
Specified what type of data should be used when drawing a color
map over the collision area.
|
static class |
CollisionBehavior.Method
Specifies the contact method defining how the constraints are
generated for handling collisions.
|
static class |
CollisionBehavior.VertexPenetrations
Indicates when two-way contact is used for the
CollisionBehavior.Method.VERTEX_PENETRATION or CollisionBehavior.Method.VERTEX_EDGE_PENETRATION
contact methods. |
ModelComponent.NavpanelVisibility
Modifier and Type | Field and Description |
---|---|
static PropertyList |
myProps |
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
TRANSPARENT, TWO_DIMENSIONAL
Constructor and Description |
---|
CollisionBehavior()
Creates a new CollisionBehavior with default values.
|
CollisionBehavior(boolean enabled,
double mu)
Creates a new CollisionBehavior with a specified enabling
and friction.
|
CollisionBehavior(CollisionBehavior behav) |
Modifier and Type | Method and Description |
---|---|
boolean |
collidable0MatchesBody(CollidableBody cbody)
Queries whether a collidable body matches the first collidable of this
behavior.
|
RenderProps |
createRenderProps()
Factory method to create render properties appropriate to this object.
|
double |
getAcceleration()
Returns the desired collision acceleration.
|
PropertyMode |
getAccelerationMode() |
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
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() |
int |
getColorMapCollidable()
Deprecated.
Use
getRenderingCollidable() instead. |
Renderer.ColorInterpolation |
getColorMapInterpolation() |
PropertyMode |
getColorMapInterpolationMode() |
ScalarRange |
getColorMapRange() |
double |
getCompliance()
Gets the contact compliance associated with this behavior.
|
PropertyMode |
getComplianceMode() |
double |
getDamping()
Gets the contact damping associated with this behavior.
|
PropertyMode |
getDampingMode() |
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() |
int |
getDrawPenetrationDepth()
Deprecated.
Replaced by the combination of
getDrawColorMap() and getRenderingCollidable . |
ContactForceBehavior |
getForceBehavior() |
double |
getFriction()
Gets the Coulomb friction coefficient associated with this behavior.
|
PropertyMode |
getFrictionMode() |
CollisionBehavior.Method |
getMethod()
Returns the contact method to be used by this behavior.
|
PropertyMode |
getMethodMode() |
ScalarRange |
getPenetrationDepthRange()
Added for backwards compatibility.
|
double |
getPenetrationTol()
Gets the penetration tolerance associated with this behavior.
|
PropertyMode |
getPenetrationTolMode() |
boolean |
getReduceConstraints()
Queries whether constraint reduction is enabled for this behavior.
|
PropertyMode |
getReduceConstraintsMode() |
int |
getRenderHints()
Returns a bit code giving rendering hints about this renderable.
|
int |
getRenderingCollidable() |
PropertyMode |
getRenderingCollidableMode() |
RenderProps |
getRenderProps()
Returns the render properities for this object.
|
boolean |
getReportNegContactForces()
Queries whether negative contact forces should be used in force
pressure maps and collision reporting.
|
PropertyMode |
getReportNegContactForcesMode() |
double |
getRigidPointTol()
Gets the rigid point tolerance associated with this behavior.
|
PropertyMode |
getRigidPointTolMode() |
double |
getRigidRegionTol()
Gets the rigid region tolerance associated with this behavior.
|
PropertyMode |
getRigidRegionTolMode() |
void |
getSelection(java.util.LinkedList<java.lang.Object> list,
int qid)
Append to
list the component (or components) associated with
the qid -th selection query issued by this component's render
method. |
double |
getStictionCompliance()
Gets the stiction compliance associated with this behavior.
|
PropertyMode |
getStictionComplianceMode() |
double |
getStictionCreep()
Gets the stiction creep associated with this behavior.
|
PropertyMode |
getStictionCreepMode() |
double |
getStictionDamping()
Gets the stiction damping associated with this behavior.
|
PropertyMode |
getStictionDampingMode() |
CollisionBehavior.VertexPenetrations |
getVertexPenetrations()
Queries when two-way contact is enabled.
|
PropertyMode |
getVertexPenetrationsMode() |
boolean |
isCompliant() |
boolean |
isEnabled()
Returns true if collisions are enabled in this behavior.
|
boolean |
isSelectable()
Returns true if this object is in fact selectable.
|
int |
numSelectionQueriesNeeded()
If this selectable manages its own selection (by issuing selection
queries within its
render method), then this method should
return the maximum number of selection queries that will be
required. |
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 |
render(Renderer renderer,
int flags)
Render method for this component is just a stub - it is needed because
this class extends RenderableComponentBase, which is done to export the
fact that the class has render properties, and also exports them as a
property.
|
void |
scaleDistance(double s) |
void |
scaleMass(double s) |
void |
set(CollisionBehavior behav) |
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 |
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 |
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 contact compliance associated with this behavior.
|
void |
setComplianceMode(PropertyMode mode) |
void |
setDamping(double d)
Sets the contact damping associated with this behavior.
|
void |
setDampingMode(PropertyMode mode) |
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) |
void |
setDrawPenetrationDepth(int colNum)
Deprecated.
Replaced by the combination of
setDrawColorMap(artisynth.core.mechmodels.CollisionBehavior.ColorMapType) and setRenderingCollidable . |
void |
setEnabled(boolean enabled)
Enables or disabled collisions for this behavior.
|
<T extends ContactForceBehavior> |
setForceBehavior(T behav) |
void |
setFriction(double mu)
Sets the Coulomb friction coefficient associated with this behavior.
|
void |
setFrictionMode(PropertyMode mode) |
void |
setMethod(CollisionBehavior.Method method)
Set the contact method to be used by this behavior.
|
void |
setMethodMode(PropertyMode mode) |
void |
setPenetrationTol(double tol)
Sets the penetration tolerance associated with this behavior.
|
void |
setPenetrationTolMode(PropertyMode mode) |
void |
setReduceConstraints(boolean enable)
Sets whether or not constraint reduction is enabled for this behavior.
|
void |
setReduceConstraintsMode(PropertyMode mode) |
void |
setRenderingCollidable(int colNum) |
void |
setRenderingCollidableMode(PropertyMode mode) |
void |
setRenderProps(RenderProps props)
Assigns a new set of render properties to this object.
|
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 |
setRigidPointTol(double tol)
Sets the rigid point tolerance associated with this behavior.
|
void |
setRigidPointTolMode(PropertyMode mode) |
void |
setRigidRegionTol(double tol)
Sets the rigid region tolerance associated with this behavior.
|
void |
setRigidRegionTolMode(PropertyMode mode) |
void |
setStictionCompliance(double compliance)
Sets the stiction compliance associated with this behavior.
|
void |
setStictionComplianceMode(PropertyMode mode) |
void |
setStictionCreep(double creep)
Sets the stiction creep associated with this behavior.
|
void |
setStictionCreepMode(PropertyMode mode) |
void |
setStictionDamping(double damping)
Sets the stiction damping associated with this behavior.
|
void |
setStictionDampingMode(PropertyMode mode) |
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.
|
getCollidable, getCollidablePair, getHardReferences, setCollidablePair, setCollidablePair
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, copy, createTempFlag, disconnectFromHierarchy, 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 static PropertyList myProps
public CollisionBehavior()
public CollisionBehavior(boolean enabled, double mu)
enabled
- true if collisions are enabledmu
- friction coefficient. If less than 0, the value
will be inherited from ancestor components.public CollisionBehavior(CollisionBehavior behav)
public PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class ModelComponentBase
public boolean isEnabled()
public void setEnabled(boolean enabled)
enabled
- if true, enables collisionspublic double getFriction()
public void setFriction(double mu)
mu
- friction coefficientpublic void setFrictionMode(PropertyMode mode)
public PropertyMode getFrictionMode()
public CollisionBehavior.Method getMethod()
public void setMethod(CollisionBehavior.Method method)
method
- contact method to be usedpublic void setMethodMode(PropertyMode mode)
public PropertyMode getMethodMode()
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 CollisionManager.ColliderType getColliderType()
public void setColliderType(CollisionManager.ColliderType ctype)
ctype
- new collider type for this behaviorpublic void setColliderTypeMode(PropertyMode mode)
public PropertyMode getColliderTypeMode()
public double getPenetrationTol()
public void setPenetrationTol(double tol)
tol
- new penetration tolerancepublic void setPenetrationTolMode(PropertyMode mode)
public PropertyMode getPenetrationTolMode()
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
- 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 double getRigidRegionTol()
public void setRigidRegionTol(double tol)
tol
- new rigid region tolerancepublic void setRigidRegionTolMode(PropertyMode mode)
public PropertyMode getRigidRegionTolMode()
public double getRigidPointTol()
public void setRigidPointTol(double tol)
tol
- new rigid point tolerancepublic void setRigidPointTolMode(PropertyMode mode)
public PropertyMode getRigidPointTolMode()
public <T extends ContactForceBehavior> void setForceBehavior(T behav)
public ContactForceBehavior getForceBehavior()
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 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 int getDrawPenetrationDepth()
getDrawColorMap()
and getRenderingCollidable
.public void setDrawPenetrationDepth(int colNum)
setDrawColorMap(artisynth.core.mechmodels.CollisionBehavior.ColorMapType)
and setRenderingCollidable
.public ScalarRange getPenetrationDepthRange()
public void setColorMapRange(ScalarRange range)
public ScalarRange getColorMapRange()
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 boolean isCompliant()
public void set(CollisionBehavior behav)
public RenderProps getRenderProps()
HasRenderProps
getRenderProps
in interface HasRenderProps
public void setRenderProps(RenderProps props)
HasRenderProps
null
will remove render properties from this object.setRenderProps
in interface HasRenderProps
props
- new render properties for this objectpublic void prerender(RenderList list)
IsRenderable
list.addIfVisible (obj);
for each of the objects in question.prerender
in interface IsRenderable
list
- list of objects to be renderedpublic void render(Renderer renderer, int flags)
render
in interface IsRenderable
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 updateBounds(Vector3d pmin, Vector3d pmax)
IsRenderable
updateBounds
in interface IsRenderable
pmin
- minimum pointpmax
- maximum pointpublic void getSelection(java.util.LinkedList<java.lang.Object> list, int qid)
IsSelectable
list
the component (or components) associated with
the qid
-th selection query issued by this component's render
method. This will only be called if this component manages its own
selection (i.e., the number nums
returned by IsSelectable.numSelectionQueriesNeeded()
is positive), and qid
will in
turn be a number between 0 and nums
-1.getSelection
in interface IsSelectable
list
- selected objects are appended to the end of this listqid
- index of the selection querypublic RenderProps createRenderProps()
HasRenderProps
createRenderProps
in interface HasRenderProps
public int getRenderHints()
IsRenderable
TRANSPARENT
and
TWO_DIMENSIONAL
.getRenderHints
in interface IsRenderable
public boolean isSelectable()
isSelectable
in interface IsSelectable
public int numSelectionQueriesNeeded()
IsSelectable
render
method), then this method should
return the maximum number of selection queries that will be
required. Otherwise, this method should return -1.numSelectionQueriesNeeded
in interface IsSelectable
public void scaleDistance(double s)
public void scaleMass(double s)
public boolean collidable0MatchesBody(CollidableBody cbody)