artisynth.core.mechmodels
Class CollisionHandlerGeneric

java.lang.Object
  extended by artisynth.core.modelbase.ModelComponentBase
      extended by artisynth.core.modelbase.RenderableComponentBase
          extended by artisynth.core.mechmodels.ConstrainerBase
              extended by artisynth.core.mechmodels.CollisionHandler
                  extended by artisynth.core.mechmodels.CollisionHandlerGeneric
All Implemented Interfaces:
Constrainer, HasAuxState, ModelComponent, RenderableComponent, java.lang.Cloneable, HasProperties, HierarchyNode, GLRenderable, GLSelectable, HasRenderProps, Renderable, Scannable

public class CollisionHandlerGeneric
extends CollisionHandler
implements Constrainer


Nested Class Summary
 
Nested classes/interfaces inherited from interface artisynth.core.mechmodels.HasAuxState
HasAuxState.StateContext
 
Nested classes/interfaces inherited from interface artisynth.core.modelbase.ModelComponent
ModelComponent.NavpanelVisibility
 
Field Summary
static boolean myIgnoreRBForGS
           
static boolean renderContactNormals
           
 
Fields inherited from class artisynth.core.mechmodels.CollisionHandler
computeTimings, doBodyFaceContact, myProps, reduceConstraints, useSignedDistanceCollider
 
Fields inherited from class artisynth.core.modelbase.ModelComponentBase
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
 
Fields inherited from interface maspack.render.GLRenderable
TRANSLUCENT, TWO_DIMENSIONAL
 
Method Summary
 void activateContact(DeformableContactConstraint cons, double dist, DeformableCollisionData data)
           
 int addBilateralConstraints(SparseBlockMatrix GT, VectorNd dg, int numb, IntHolder changeCnt)
           
 int addFrictionConstraints(SparseBlockMatrix DT, MechSystem.FrictionInfo[] finfo, int numf)
           
 void autoComputeCompliance(double acc, double tol)
          Automatically compute compliance and damping for a given penetration tolerance and acceleration.
 RenderProps createRenderProps()
          Factory method to create render properties appropriate to this object.
 boolean equals(Collidable c0, Collidable c1)
           
 boolean equals(java.lang.Object obj)
           
 void getAuxState(DataBuffer data)
          Saves state information for this component by adding data to the supplied DataBuffer.
 int getBilateralImpulses(VectorNd lam, int idx)
           
 int getBilateralInfo(MechSystem.ConstraintInfo[] ginfo, int idx)
           
 void getBilateralSizes(VectorNi sizes)
           
 Collidable getCollidable(int idx)
           
 Collidable getCollidable0()
           
 Collidable getCollidable1()
           
 double getCompliance()
           
 double getDamping()
           
 double getFriction()
          Returns the coefficient of friction for this collision pair.
 void getInitialAuxState(DataBuffer newData, DataBuffer oldData)
          Saves initial state information data for this component by adding data to the supplied data buffer.
 double getPenetrationTol()
           
 RigidBodyContact getRigidBodyContact()
           
 double getRigidPointTolerance()
           
 double getRigidRegionTolerance()
           
 boolean hasActiveContacts()
          Checks if this collision handler has any active contact constraints
 int hashCode()
           
 boolean isDrawIntersectionContours()
           
 boolean isDrawIntersectionFaces()
           
 boolean isDrawIntersectionPoints()
           
 boolean isRigidBodyPair()
          Returns true if this collision pair is between two rigid bodies.
 int maxFrictionConstraintSets()
           
 void prerender(RenderList list)
          Prepare for rendering, and potentially add itself to a list to be drawn by a GLRenderer.
 double projectPosConstraints(double t)
          Compute contacts and approximately correct interpenetrations for this collision pair.
 void render(GLRenderer renderer, int flags)
          Render this object using Open GL via the JOGL.
 void render(GLRenderer renderer, RenderProps props, int flags)
           
 void setAuxState(DataBuffer data)
          Restores the state for this component by reading from the supplied data buffer, starting at the current buffer offsets.
 int setBilateralImpulses(VectorNd lam, double h, int idx)
           
 void setCompliance(double c)
           
 void setDamping(double d)
           
 void setDrawIntersectionContours(boolean set)
           
 void setDrawIntersectionFaces(boolean set)
           
 void setDrawIntersectionPoints(boolean set)
           
 void setFriction(double mu)
          Sets the coeffcient of friction for this collision pair.
 void setPenetrationTol(double tol)
           
 void setRigidPointTolerance(double tol)
           
 void setRigidRegionTolerance(double tol)
           
 void skipAuxState(DataBuffer data)
          Skips over the state information for this component contained in the supplied data buffer, starting at the current buffer offsets.
 void structureOrActivityChanged()
          Notifies this CollisionPair that the component structure or activity has changes and so the constraint structures will need to be recomputed.
 void updateBounds(Point3d pmin, Point3d pmax)
          Update the minimum and maximum points for this object.
 double updateConstraints(double t, int flags)
           
 void updateFrictionConstraints()
           
 void zeroImpulses()
           
 
Methods inherited from class artisynth.core.mechmodels.CollisionHandler
getAllPropertyInfo
 
Methods inherited from class artisynth.core.mechmodels.ConstrainerBase
addUnilateralConstraints, advanceAuxState, getUnilateralImpulses, getUnilateralInfo, getUnilateralSizes, hasState, setUnilateralImpulses
 
Methods inherited from class artisynth.core.modelbase.RenderableComponentBase
copy, getRenderHints, getRenderProps, getSelection, isSelectable, numSelectionQueriesNeeded, setRenderProps, updateRenderProps
 
Methods inherited from class artisynth.core.modelbase.ModelComponentBase
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getChildren, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, hasChildren, isFixed, isMarked, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, postscan, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, scan, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setSelected, updateReferences, write
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface artisynth.core.mechmodels.Constrainer
addUnilateralConstraints, getUnilateralImpulses, getUnilateralInfo, getUnilateralSizes, setUnilateralImpulses
 
Methods inherited from interface maspack.render.HasRenderProps
getRenderProps, setRenderProps
 
Methods inherited from interface maspack.render.GLRenderable
getRenderHints
 
Methods inherited from interface artisynth.core.modelbase.ModelComponent
connectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, isFixed, isMarked, isSelected, notifyParentOfChange, postscan, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, updateReferences
 
Methods inherited from interface maspack.properties.HasProperties
getProperty
 
Methods inherited from interface maspack.properties.HierarchyNode
getChildren, hasChildren
 
Methods inherited from interface maspack.util.Scannable
isWritable, write
 

Field Detail

myIgnoreRBForGS

public static boolean myIgnoreRBForGS

renderContactNormals

public static boolean renderContactNormals
Method Detail

autoComputeCompliance

public void autoComputeCompliance(double acc,
                                  double tol)
Automatically compute compliance and damping for a given penetration tolerance and acceleration.

Specified by:
autoComputeCompliance in class CollisionHandler
Parameters:
acc - acceleration
tol - desired penetration tolerance

setRigidPointTolerance

public void setRigidPointTolerance(double tol)
Specified by:
setRigidPointTolerance in class CollisionHandler

getRigidPointTolerance

public double getRigidPointTolerance()
Specified by:
getRigidPointTolerance in class CollisionHandler

setRigidRegionTolerance

public void setRigidRegionTolerance(double tol)
Specified by:
setRigidRegionTolerance in class CollisionHandler

getRigidRegionTolerance

public double getRigidRegionTolerance()
Specified by:
getRigidRegionTolerance in class CollisionHandler

isRigidBodyPair

public boolean isRigidBodyPair()
Returns true if this collision pair is between two rigid bodies.


getRigidBodyContact

public RigidBodyContact getRigidBodyContact()

getFriction

public double getFriction()
Returns the coefficient of friction for this collision pair.

Specified by:
getFriction in class CollisionHandler

setFriction

public void setFriction(double mu)
Sets the coeffcient of friction for this collision pair.

Specified by:
setFriction in class CollisionHandler

getPenetrationTol

public double getPenetrationTol()
Specified by:
getPenetrationTol in class CollisionHandler

setPenetrationTol

public void setPenetrationTol(double tol)
Specified by:
setPenetrationTol in class CollisionHandler

setCompliance

public void setCompliance(double c)
Specified by:
setCompliance in class CollisionHandler

getCompliance

public double getCompliance()
Specified by:
getCompliance in class CollisionHandler

setDamping

public void setDamping(double d)
Specified by:
setDamping in class CollisionHandler

getDamping

public double getDamping()
Specified by:
getDamping in class CollisionHandler

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getCollidable0

public Collidable getCollidable0()
Specified by:
getCollidable0 in class CollisionHandler

getCollidable1

public Collidable getCollidable1()
Specified by:
getCollidable1 in class CollisionHandler

getCollidable

public Collidable getCollidable(int idx)
Specified by:
getCollidable in class CollisionHandler

equals

public boolean equals(Collidable c0,
                      Collidable c1)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

updateFrictionConstraints

public void updateFrictionConstraints()

projectPosConstraints

public double projectPosConstraints(double t)
Compute contacts and approximately correct interpenetrations for this collision pair. Contacts will be assigned constraints, which will be used later to constrain velocities and compute friction.

This method currently handles only deformable-deformable and deformable-rigidBody collisions; rigidBody-rigidBody collisions are handled separately.

Parameters:
t - current time (not currently used)

hasActiveContacts

public boolean hasActiveContacts()
Description copied from class: CollisionHandler
Checks if this collision handler has any active contact constraints

Specified by:
hasActiveContacts in class CollisionHandler

activateContact

public void activateContact(DeformableContactConstraint cons,
                            double dist,
                            DeformableCollisionData data)

structureOrActivityChanged

public void structureOrActivityChanged()
Notifies this CollisionPair that the component structure or activity has changes and so the constraint structures will need to be recomputed.


getBilateralSizes

public void getBilateralSizes(VectorNi sizes)
Specified by:
getBilateralSizes in interface Constrainer
Specified by:
getBilateralSizes in class ConstrainerBase

addBilateralConstraints

public int addBilateralConstraints(SparseBlockMatrix GT,
                                   VectorNd dg,
                                   int numb,
                                   IntHolder changeCnt)
Specified by:
addBilateralConstraints in interface Constrainer
Specified by:
addBilateralConstraints in class ConstrainerBase

getBilateralInfo

public int getBilateralInfo(MechSystem.ConstraintInfo[] ginfo,
                            int idx)
Specified by:
getBilateralInfo in interface Constrainer
Specified by:
getBilateralInfo in class ConstrainerBase

setBilateralImpulses

public int setBilateralImpulses(VectorNd lam,
                                double h,
                                int idx)
Specified by:
setBilateralImpulses in interface Constrainer
Specified by:
setBilateralImpulses in class ConstrainerBase

zeroImpulses

public void zeroImpulses()
Specified by:
zeroImpulses in interface Constrainer
Specified by:
zeroImpulses in class ConstrainerBase

getBilateralImpulses

public int getBilateralImpulses(VectorNd lam,
                                int idx)
Specified by:
getBilateralImpulses in interface Constrainer
Specified by:
getBilateralImpulses in class ConstrainerBase

maxFrictionConstraintSets

public int maxFrictionConstraintSets()
Specified by:
maxFrictionConstraintSets in interface Constrainer
Overrides:
maxFrictionConstraintSets in class ConstrainerBase

addFrictionConstraints

public int addFrictionConstraints(SparseBlockMatrix DT,
                                  MechSystem.FrictionInfo[] finfo,
                                  int numf)
Specified by:
addFrictionConstraints in interface Constrainer
Overrides:
addFrictionConstraints in class ConstrainerBase

setDrawIntersectionContours

public void setDrawIntersectionContours(boolean set)
Specified by:
setDrawIntersectionContours in class CollisionHandler

isDrawIntersectionContours

public boolean isDrawIntersectionContours()
Specified by:
isDrawIntersectionContours in class CollisionHandler

setDrawIntersectionFaces

public void setDrawIntersectionFaces(boolean set)
Specified by:
setDrawIntersectionFaces in class CollisionHandler

isDrawIntersectionFaces

public boolean isDrawIntersectionFaces()
Specified by:
isDrawIntersectionFaces in class CollisionHandler

setDrawIntersectionPoints

public void setDrawIntersectionPoints(boolean set)
Specified by:
setDrawIntersectionPoints in class CollisionHandler

isDrawIntersectionPoints

public boolean isDrawIntersectionPoints()
Specified by:
isDrawIntersectionPoints in class CollisionHandler

prerender

public void prerender(RenderList list)
Description copied from interface: GLRenderable
Prepare for rendering, and potentially add itself to a list to be drawn by a GLRenderer.

Specified by:
prerender in interface GLRenderable
Overrides:
prerender in class RenderableComponentBase

createRenderProps

public RenderProps createRenderProps()
Description copied from interface: HasRenderProps
Factory method to create render properties appropriate to this object.

Specified by:
createRenderProps in interface HasRenderProps
Overrides:
createRenderProps in class RenderableComponentBase
Returns:
new render properties for this object

render

public void render(GLRenderer renderer,
                   int flags)
Description copied from interface: GLRenderable
Render this object using Open GL via the JOGL.

Specified by:
render in interface GLRenderable
Specified by:
render in class RenderableComponentBase
Parameters:
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.

render

public void render(GLRenderer renderer,
                   RenderProps props,
                   int flags)
Specified by:
render in class CollisionHandler

updateBounds

public void updateBounds(Point3d pmin,
                         Point3d pmax)
Description copied from interface: GLRenderable
Update the minimum and maximum points for this object. In an x-y-z coordinate system with x directed to the right and y directed upwards, the minimum and maximum points can be thought of as defining the left-lower-far and right-upper-near corners of a bounding cube. This method should only reduce the elements of the minimum point and increase the elements of the maximum point, since it may be used as part of an iteration to determine the bounding cube for several different objects.

Specified by:
updateBounds in interface GLRenderable
Overrides:
updateBounds in class RenderableComponentBase
Parameters:
pmin - minimum point
pmax - maximum point

skipAuxState

public void skipAuxState(DataBuffer data)
Skips over the state information for this component contained in the supplied data buffer, starting at the current buffer offsets. Essentially this a dummy read; the buffer offsets should be advanced over the state information, but that information should not actually be stored in the component.

Specified by:
skipAuxState in interface HasAuxState
Overrides:
skipAuxState in class ConstrainerBase
Parameters:
data - buffer containing the state information

getAuxState

public void getAuxState(DataBuffer data)
Saves state information for this component by adding data to the supplied DataBuffer. Existing data in the buffer should not be disturbed.

Specified by:
getAuxState in interface HasAuxState
Overrides:
getAuxState in class ConstrainerBase
Parameters:
data - buffer for storing the state values.

getInitialAuxState

public void getInitialAuxState(DataBuffer newData,
                               DataBuffer oldData)
Saves initial state information data for this component by adding data to the supplied data buffer. Existing data in the buffer should not be disturbed.

If oldData is non-null, then this contains previously stored initial state information (starting at its current buffer offsets), which should be stored into newData in place of the current component state data. This may only be partially possible if the component's state structure has changed since oldData was written.

Specified by:
getInitialAuxState in interface HasAuxState
Overrides:
getInitialAuxState in class ConstrainerBase
Parameters:
newData - buffer for storing the state values.
oldData - if non-null, contains old state information that should be written into newData in place of the current state information.

setAuxState

public void setAuxState(DataBuffer data)
Restores the state for this component by reading from the supplied data buffer, starting at the current buffer offsets.

Specified by:
setAuxState in interface HasAuxState
Overrides:
setAuxState in class ConstrainerBase
Parameters:
data - buffer containing the state information

updateConstraints

public double updateConstraints(double t,
                                int flags)
Specified by:
updateConstraints in interface Constrainer
Specified by:
updateConstraints in class ConstrainerBase