public class CollisionHandler extends RenderableConstrainerBase implements HasRenderProps, Renderable
ModelComponent.FilePathSaveType, ModelComponent.NavpanelVisibility| Modifier and Type | Field and Description |
|---|---|
static boolean |
computeTimings |
static boolean |
myPrune |
static boolean |
preventBilateralSeparation |
myPropsenforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNamesTRANSPARENT, TWO_DIMENSIONAL| Constructor and Description |
|---|
CollisionHandler(CollisionManager manager) |
CollisionHandler(CollisionManager manager,
CollidableBody col0,
CollidableBody col1,
CollisionBehavior behav,
artisynth.core.mechmodels.CollisionManager.BehaviorSource src) |
| 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. |
static boolean |
attachedNearContact(ContactPoint cpnt,
Collidable collidable,
java.util.Set<Vertex3d> attachedVertices) |
void |
clearContactActivity() |
double |
computeCollisionConstraints(ContactInfo cinfo) |
void |
getBilateralConstraints(java.util.List<ContactConstraint> list) |
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.
|
int |
getBodyIndex(Collidable col)
Returns 0 if a specified collidable is associated with this handler's
first collidable body, 1 if it is associated with the second body,
and -1 if it is associated with neither.
|
CollidableBody |
getCollidable(int cidx) |
CollidablePair |
getCollidablePair() |
void |
getConstrainedComponents(java.util.HashSet<DynamicComponent> set)
Collected all the dynamic components constrained by this constrainer.
|
ContactConstraint |
getContact(java.util.HashMap<ContactPoint,ContactConstraint> contacts,
ContactPoint cpnt0,
ContactPoint cpnt1,
boolean hashUsingFace,
boolean pnt0OnCollidable1,
double distance) |
CollisionHandler |
getDown()
Returns next handler in a column of a CollisionHandlerTable.
|
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). |
int |
getFrictionState(VectorNi state,
int idx) |
ContactInfo |
getLastContactInfo() |
CollisionHandler |
getNext()
Returns next handler in a row of a CollisionHandlerTable.
|
CollidableBody |
getOtherCollidable(CollidableBody cb) |
RenderProps |
getRenderProps()
Returns the render properities for this object.
|
void |
getState(DataBuffer data)
Saves state information for this component by adding data to the
supplied DataBuffer.
|
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) |
int |
maxFrictionConstraintSets()
Returns the maximum number of friction constraint sets that can be
expected for this constraint.
|
int |
numBilateralConstraints() |
int |
numUnilateralConstraints() |
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 |
prerender(RenderProps props) |
void |
printNetContactForces() |
void |
removeInactiveContacts() |
void |
render(Renderer renderer,
int flags)
Render this object using the functionality of the supplied
Renderer. |
void |
render(Renderer renderer,
RenderProps props,
int flags) |
int |
setBilateralForces(VectorNd lam,
double s,
int idx)
Sets the bilateral forces that were computed to enforce this
constraint.
|
void |
setDown(CollisionHandler down)
Sets next handler in a column of a CollisionHandlerTable.
|
int |
setFrictionForces(VectorNd phi,
double s,
int idx)
Sets the friction forces that were computed to enforce this
constraint.
|
int |
setFrictionState(VectorNi state,
int idx) |
void |
setNext(CollisionHandler next)
Sets next handler in a row of a CollisionHandlerTable.
|
void |
setState(DataBuffer data)
Restores the state for this component by reading from the supplied
data buffer, starting at the current buffer offsets.
|
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 |
updateBounds(Vector3d pmin,
Vector3d pmax)
Update the minimum and maximum points for this object.
|
double |
updateConstraints(double t,
int flags)
Updates the current set of constraints, and returns the maximum
penetration
> 0 associated with all of them. |
void |
zeroForces()
Zeros all bilateral and unilateral constraint forces in this constraint.
|
copy, createRenderProps, defaultRenderPropsAreNull, getAllPropertyInfo, getRenderHints, getSelection, isSelectable, numSelectionQueriesNeeded, setRenderPropshasStatecheckFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getChildren, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, hasChildren, 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, writeequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetSelection, isSelectable, numSelectionQueriesNeededgetRenderHintscreateRenderProps, setRenderPropsconnectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, setWritable, updateReferencesgetPropertygetChildren, hasChildrenpostscanisWritable, writeadvanceState, getAuxVarDerivative, getAuxVarState, getStateVersion, numAuxVars, requiresAdvance, setAuxVarStatepublic static boolean computeTimings
public static boolean preventBilateralSeparation
public static boolean myPrune
public CollisionHandler(CollisionManager manager)
public CollisionHandler(CollisionManager manager, CollidableBody col0, CollidableBody col1, CollisionBehavior behav, artisynth.core.mechmodels.CollisionManager.BehaviorSource src)
public RenderProps getRenderProps()
HasRenderPropsgetRenderProps in interface HasRenderPropsgetRenderProps in class RenderableConstrainerBasepublic ContactInfo getLastContactInfo()
public static boolean attachedNearContact(ContactPoint cpnt, Collidable collidable, java.util.Set<Vertex3d> attachedVertices)
public ContactConstraint getContact(java.util.HashMap<ContactPoint,ContactConstraint> contacts, ContactPoint cpnt0, ContactPoint cpnt1, boolean hashUsingFace, boolean pnt0OnCollidable1, double distance)
public double computeCollisionConstraints(ContactInfo cinfo)
public CollidableBody getCollidable(int cidx)
public int getBodyIndex(Collidable col)
col - collidable to inspectcol.public CollidableBody getOtherCollidable(CollidableBody cb)
public CollidablePair getCollidablePair()
public CollisionHandler getNext()
public void setNext(CollisionHandler next)
next - next handler to add to the rowpublic CollisionHandler getDown()
public void setDown(CollisionHandler down)
down - next handler to add to the columnpublic void clearContactActivity()
public void removeInactiveContacts()
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 ConstrainerupdateConstraints in class ConstrainerBasepublic void getConstrainedComponents(java.util.HashSet<DynamicComponent> set)
ConstrainergetConstrainedComponents in interface ConstrainergetConstrainedComponents in class ConstrainerBaseset - set to which constrained components should be addedpublic void getBilateralSizes(VectorNi sizes)
Constrainersizes.getBilateralSizes in interface ConstrainergetBilateralSizes in class ConstrainerBasesizes - vector to which the block column sizes are appendedpublic void getUnilateralSizes(VectorNi sizes)
Constrainersizes.getUnilateralSizes in interface ConstrainergetUnilateralSizes in class ConstrainerBasesizes - vector to which the block column sizes are appendedpublic void getBilateralConstraints(java.util.List<ContactConstraint> list)
public int addBilateralConstraints(SparseBlockMatrix GT, VectorNd dg, int numb)
ConstrainerGc^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 ConstraineraddBilateralConstraints in class ConstrainerBaseGT - 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 dgnumbpublic int getBilateralInfo(MechSystem.ConstraintInfo[] ginfo, int idx)
ConstrainerGc 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 ConstrainergetBilateralInfo in class ConstrainerBaseginfo - returns the constraint informationidx - starting location in ginfo for returning constraint
infoidxpublic int setBilateralForces(VectorNd lam, double s, int idx)
Constrainerlam, 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 ConstrainersetBilateralForces in class ConstrainerBaselam - supplies the force impulses, which should be scaled by ss - scaling factor for the force valuesidx - starting index of forces in lamidxpublic int getBilateralForces(VectorNd lam, int idx)
ConstrainerConstrainer.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 ConstrainergetBilateralForces in class ConstrainerBaselam - returns the forcesidx - starting index for forces in lamidxpublic void zeroForces()
ConstrainerzeroForces in interface ConstrainerzeroForces in class ConstrainerBasepublic int addUnilateralConstraints(SparseBlockMatrix NT, VectorNd dn, int numu)
ConstrainerNc^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 ConstraineraddUnilateralConstraints in class ConstrainerBaseNT - 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 dnnumupublic int getUnilateralInfo(MechSystem.ConstraintInfo[] ninfo, int idx)
ConstrainerNc 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 ConstrainergetUnilateralInfo in class ConstrainerBaseninfo - returns the constraint informationidx - starting location in ninfo for returning constraint
infoidxpublic int setUnilateralForces(VectorNd the, double s, int idx)
Constrainerthe, 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 ConstrainersetUnilateralForces in class ConstrainerBasethe - supplies the force impulses, which should be scaled by ss - scaling factor for the force valuesidx - starting index of forces in theidxpublic int getUnilateralForces(VectorNd the, int idx)
ConstrainerConstrainer.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 ConstrainergetUnilateralForces in class ConstrainerBasethe - returns the forcesidx - starting index for forces in theidxpublic int setUnilateralState(VectorNi state, int idx)
setUnilateralState in interface ConstrainersetUnilateralState in class ConstrainerBasepublic int getUnilateralState(VectorNi state, int idx)
getUnilateralState in interface ConstrainergetUnilateralState in class ConstrainerBasepublic int maxFrictionConstraintSets()
Constrainerfinfo argument that is
passed to Constrainer.addFrictionConstraints(maspack.matrix.SparseBlockMatrix, java.util.ArrayList<maspack.spatialmotion.FrictionInfo>, boolean, int).maxFrictionConstraintSets in interface ConstrainermaxFrictionConstraintSets in class ConstrainerBasepublic int addFrictionConstraints(SparseBlockMatrix DT, java.util.ArrayList<FrictionInfo> finfo, boolean prune, int numf)
ConstrainerDc^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 ConstraineraddFrictionConstraints in class ConstrainerBaseDT - matrix to which the friction force contraint matrix
is appended.finfo - returns friction constraint information for each
block column in Dc^Tprune - restrict entries of DT to friction constraints
for which the contact force is > 0.numf - starting index for friction information in finfoidxpublic 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 ConstrainersetFrictionForces in class ConstrainerBasephi - supplies the force impulses, which should be scaled by ss - scaling factor for the force valuesidx - starting index of forces in phiidxpublic 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 ConstrainergetFrictionForces in class ConstrainerBasephi - returns the forcesidx - starting index for forces in phiidxpublic int setFrictionState(VectorNi state, int idx)
setFrictionState in interface ConstrainersetFrictionState in class ConstrainerBasepublic int getFrictionState(VectorNi state, int idx)
getFrictionState in interface ConstrainergetFrictionState in class ConstrainerBasepublic void printNetContactForces()
public int numBilateralConstraints()
public int numUnilateralConstraints()
public void getState(DataBuffer data)
getState in interface HasNumericStategetState in class ConstrainerBasedata - buffer for storing the state values.public void setState(DataBuffer data)
setState in interface HasNumericStatesetState in class ConstrainerBasedata - buffer containing the state informationpublic void prerender(RenderProps props)
public void prerender(RenderList list)
IsRenderablelist.addIfVisible (obj);
for each of the objects in question.prerender in interface IsRenderableprerender in class RenderableConstrainerBaselist - list of objects to be renderedpublic void render(Renderer renderer, int flags)
IsRenderableRenderer.render in interface IsRenderablerender in class RenderableConstrainerBaserenderer - 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 render(Renderer renderer, RenderProps props, int flags)
public void updateBounds(Vector3d pmin, Vector3d pmax)
IsRenderableupdateBounds in interface IsRenderableupdateBounds in class RenderableConstrainerBasepmin - minimum pointpmax - maximum point