public class PointSkinAttachment extends PointAttachment implements TransformableGeometry, ScalableUnits, ContactMaster
The class maintains a list of Connection objects for each
underlying dynamic component (such as a Frame or
FemNode3d) that has a weighted influence on the point's final
value.
| Modifier and Type | Class and Description |
|---|---|
static class |
PointSkinAttachment.ElementConnection |
static class |
PointSkinAttachment.FemConnection |
class |
PointSkinAttachment.FemDispConnection |
class |
PointSkinAttachment.FrameConnection |
static class |
PointSkinAttachment.SkinConnection<C extends PointSkinAttachment.SkinConnection<C>>
Defines connections associated with this attachment.
|
ModelComponent.FilePathSaveType, ModelComponent.NavpanelVisibility| Modifier and Type | Field and Description |
|---|---|
boolean |
debug |
boolean |
useFemMasterBlocksForContact |
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, myProps, NULL_OBJ, useCompactPathNamesTG_ARTICULATED, TG_DRAGGER, TG_PRESERVE_ORIENTATION, TG_SIMULATINGCOPY_REFERENCES, REST_POSITION| Constructor and Description |
|---|
PointSkinAttachment()
Creates an empty PointSkinAttachment.
|
PointSkinAttachment(Point slave) |
| Modifier and Type | Method and Description |
|---|---|
void |
add1DConstraintBlocks(SparseBlockMatrix GT,
int bj,
double scale,
ContactPoint cpnt,
Vector3d dir)
Adds blocks to the constraint matrix GT to implement a 1D constraint in a
specified direction.
|
void |
add2DConstraintBlocks(SparseBlockMatrix GT,
int bj,
double scale,
ContactPoint cpnt,
Vector3d dir0,
Vector3d dir1)
Adds blocks to the constraint matrix GT to implement a 2D constraint in
two specified directions.
|
void |
addBackRefsIfConnected()
Add backrefs if this attachment is connected *and* controlling a point
|
void |
addForce(Vector3d f) |
void |
addFrameConnection(SkinMeshBody.FrameInfo frameInfo,
double weight)
Adds a Frame connection to this attachment.
|
void |
addMassToMasters() |
void |
addRelativeVelocity(Vector3d vel,
double scale,
ContactPoint cpnt)
Accumulate the velocity at the contact due to the current
velocity of the underlying dynamic components.
|
void |
addTransformableDependencies(TransformGeometryContext context,
int flags)
Adds to
context any transformable components which should be
transformed as the same time as this component. |
void |
applyForces() |
void |
clearConnections()
Clear the connections used by this attachment.
|
int |
collectMasterComponents(java.util.HashSet<DynamicComponent> masters,
boolean activeOnly)
Collects all the underlying dynamic ``master'' components.
|
void |
computeForceOnMasters(VectorNd uvec,
Vector3d fc,
double scale,
ContactPoint cpnt,
SparseBlockMatrix S)
XXX Experimental XXX
Compute the forces on the masters resulting from a force
fc applied at the contact point, and accumulate them in uvec,
whose size should equal that of the system forces.
|
void |
connectToHierarchy(CompositeComponent hcomp)
Update the attachment position state whenever we connect to the parent
(i.e., plug in to the hierarchy).
|
PointSkinAttachment |
copy(int flags,
java.util.Map<ModelComponent,ModelComponent> copyMap)
Create a copy of this component.
|
void |
disconnectFromHierarchy(CompositeComponent hcomp)
Update the attachment position state whenever we connect to the parent
(i.e., plug in to the hierarchy).
|
Point3d |
getBasePosition()
Gets the base position for this attachment.
|
float |
getBaseWeight()
Gets the base weight for this attachment.
|
PointSkinAttachment.SkinConnection |
getConnection(int idx) |
double |
getConnectionWeight(int idx) |
void |
getCurrentPos(Vector3d pos)
Returns the current position of the attached point, in world coordinates.
|
void |
getCurrentVel(Vector3d vel,
Vector3d dvel) |
boolean |
getDerivative(double[] buf,
int idx) |
PointSkinAttachment.FemConnection |
getFemConnection(int idx) |
PointSkinAttachment.FemConnection |
getFemConnections() |
PointSkinAttachment.FrameConnection |
getFrameConnection(int idx) |
PointSkinAttachment.FrameConnection |
getFrameConnections() |
MatrixBlock |
getGT(int idx)
Returns the transpose of the constraint matrix G associated
with the idx-th master component.
|
void |
getHardReferences(java.util.List<ModelComponent> refs)
Appends all hard references for this component to a list.
|
MatrixBlock[] |
getMasterBlocks()
Returns the most recently updated set of master blocks for this
attachments.
|
SkinMeshBody |
getSkinMesh()
Finds the SkinMeshBody, if any, associated with this attachment.
|
void |
getSoftReferences(java.util.List<ModelComponent> refs)
Appends all soft references for this component to a list.
|
void |
invalidateMasters() |
boolean |
isControllable()
Queries whether at least one of the underlying dynamic components is
controllable.
|
static void |
main(java.lang.String[] args) |
void |
mulSubGT(double[] ybuf,
int yoff,
double[] xbuf,
int xoff,
int idx)
Computes
|
void |
mulSubGTM(MatrixBlock D,
MatrixBlock M,
int idx)
Computes
|
void |
mulSubMG(MatrixBlock D,
MatrixBlock M,
int idx)
Computes
|
void |
notifyMastersOfPositionChange()
If necessary, notify this attachment's master components that the
position state of one or more of them has changed.
|
int |
numConnections()
Returns the number of connections (to master components) used by this
attachment.
|
int |
numFemConnections() |
int |
numFrameConnections() |
void |
postscan(java.util.Deque<ScanToken> tokens,
CompositeComponent ancestor)
Performs any required post-scanning for this component.
|
void |
removeBackRefsIfConnected()
Remove backrefs if this attachment is connected *and* controlling a point
|
void |
scaleDistance(double s)
Scales all distance coordinates.
|
void |
scaleMass(double s)
Scales all mass units.
|
void |
setBasePosition(Vector3d pos)
Sets the base position for this attachment.
|
void |
setBaseWeight(double w,
boolean normalize)
Sets the base weight for this attachment.
|
void |
transformGeometry(AffineTransform3dBase X)
Applies an affine transformation to the geometry of this component.
|
void |
transformGeometry(GeometryTransformer gtr,
TransformGeometryContext context,
int flags)
Transforms the geometry of this component, using the geometry transformer
gtr to transform its individual attributes. |
void |
updateAttachment()
Update attachment to reflect changes in the slave state.
|
int |
updateFrameMasterBlocks(SkinMeshBody.FrameBlending blending) |
void |
updatePosStates() |
void |
updateReferences(boolean undo,
java.util.Deque<java.lang.Object> undoInfo)
May be called by the system if any of the soft references for
this component are removed from the the component hierarchy.
|
void |
updateVelStates() |
void |
writeItems(java.io.PrintWriter pw,
NumberFormat fmt,
CompositeComponent ancestor) |
addTargetJacobian, checkMasterBlocks, getCopyReferences, getMasters, getPoint, getSlave, isDuplicatable, numMastersaddBackRefs, addBackRefs, addConnectedMasterRefs, clone, connectAttachment, getAttachment, oneMasterActive, oneMasterNotAttached, removeBackRefs, removeBackRefs, removeConnectedMasterRefs, setSlaveAffectsStiffness, slaveAffectsStiffnesscheckFlag, checkName, checkNameUniqueness, clearFlag, createTempFlag, getAllPropertyInfo, getChildren, getGrandParent, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, hasChildren, hasState, isFixed, isMarked, isScanning, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, scan, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setScanning, setSelected, setWritable, writeequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittransformPrioritygetName, getNavpanelVisibility, getNumber, getParent, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, setWritablegetAllPropertyInfo, getPropertygetChildren, hasChildrenisWritable, writepublic boolean useFemMasterBlocksForContact
public boolean debug
public PointSkinAttachment()
public PointSkinAttachment(Point slave)
public SkinMeshBody getSkinMesh()
public Point3d getBasePosition()
public void setBasePosition(Vector3d pos)
public float getBaseWeight()
public void setBaseWeight(double w,
boolean normalize)
w - new base weightnormalize - if true and the connection weights sum to a
non-zero value, scales the connections weights so that the total weight
sum remains unchangedpublic int numConnections()
public PointSkinAttachment.SkinConnection getConnection(int idx)
public double getConnectionWeight(int idx)
public void clearConnections()
public void addBackRefsIfConnected()
public void removeBackRefsIfConnected()
public void addFrameConnection(SkinMeshBody.FrameInfo frameInfo, double weight)
SkinMeshBody.getFrameBlending()).frameInfo - FrameInfo structure within the associated SkinMeshBody.weight - connection weight.addFemConnectionpublic PointSkinAttachment.FrameConnection getFrameConnections()
public PointSkinAttachment.FrameConnection getFrameConnection(int idx)
public int numFrameConnections()
public PointSkinAttachment.FemConnection getFemConnections()
public PointSkinAttachment.FemConnection getFemConnection(int idx)
public int numFemConnections()
public void invalidateMasters()
invalidateMasters in interface DynamicAttachmentinvalidateMasters in class PointAttachmentpublic MatrixBlock[] getMasterBlocks()
public int updateFrameMasterBlocks(SkinMeshBody.FrameBlending blending)
public void getCurrentPos(Vector3d pos)
PointAttachmentgetCurrentPos in class PointAttachmentpos - used to return current point positionpublic void notifyMastersOfPositionChange()
PointAttachmentPointAttachment.createNumericMasterBlocks(). Attachments
only need to implement this method when setting the position state of one
or more masters, in isolation, incurs the need for other updates before a
subsequwent call to DynamicAttachmentBase.updatePosStates() will perform correctly.notifyMastersOfPositionChange in class PointAttachmentpublic void updatePosStates()
updatePosStates in interface DynamicAttachmentupdatePosStates in class DynamicAttachmentBasepublic void updateVelStates()
updateVelStates in interface DynamicAttachmentupdateVelStates in class DynamicAttachmentBasepublic void applyForces()
applyForces in interface DynamicAttachmentapplyForces in class PointAttachmentpublic void addForce(Vector3d f)
public void mulSubGTM(MatrixBlock D, MatrixBlock M, int idx)
DynamicAttachmentBase
T
D -= G M
where D and M are matrices associated with master and slave components,
respectively, and G is the constraint matrix for the attachment.mulSubGTM in interface DynamicAttachmentmulSubGTM in class DynamicAttachmentBaseD - dependent matrix associated with a master componentM - matrix associated with a slave componentpublic void mulSubMG(MatrixBlock D, MatrixBlock M, int idx)
DynamicAttachmentBaseD -= M Gwhere D and M are matrices associated with master and slave components, respectively, and G is the constraint matrix for the attachment.
mulSubMG in interface DynamicAttachmentmulSubMG in class DynamicAttachmentBaseD - dependent matrix associated with a master componentM - matrix associated with a slave componentpublic MatrixBlock getGT(int idx)
DynamicAttachmentBasegetGT in interface DynamicAttachmentgetGT in class DynamicAttachmentBaseidx - index of the master componentpublic void mulSubGT(double[] ybuf,
int yoff,
double[] xbuf,
int xoff,
int idx)
DynamicAttachmentBase
T
y -= G x
where y and x are vectors associated with master and slave components,
respectively, and G is the constraint matrix for the attachment.mulSubGT in interface DynamicAttachmentmulSubGT in class DynamicAttachmentBaseybuf - buffer into which to store resultyoff - offset into ybufxbuf - buffer containing right hand side vectorxoff - offset into xbufidx - master component indexpublic void updateAttachment()
DynamicAttachmentBaseupdateAttachment in interface DynamicAttachmentupdateAttachment in class DynamicAttachmentBasepublic void addMassToMasters()
addMassToMasters in interface DynamicAttachmentaddMassToMasters in class DynamicAttachmentBasepublic void postscan(java.util.Deque<ScanToken> tokens, CompositeComponent ancestor) throws java.io.IOException
PostScannablescan() method and stored in the token queue.
The most common use of this method is to resolve the paths
of component references, which may not have been created
at the time of the initial scan() call.postscan in interface PostScannablepostscan in class ModelComponentBasetokens - token information that was stored during
scan().ancestor - ancestor component with respect to which
reference component paths are defined.java.io.IOException - if an error is encountered (such as a reference to a
non-existent component)public void writeItems(java.io.PrintWriter pw,
NumberFormat fmt,
CompositeComponent ancestor)
throws java.io.IOException
writeItems in class PointAttachmentjava.io.IOExceptionpublic boolean getDerivative(double[] buf,
int idx)
getDerivative in interface DynamicAttachmentgetDerivative in class DynamicAttachmentBasepublic void getHardReferences(java.util.List<ModelComponent> refs)
ModelComponentBasegetHardReferences in interface ModelComponentgetHardReferences in class DynamicAttachmentBaserefs - list to which hard references are appendedpublic void getSoftReferences(java.util.List<ModelComponent> refs)
ModelComponentBaseupdateReferences() method will
be called to update its internal reference information.getSoftReferences in interface ModelComponentgetSoftReferences in class ModelComponentBaserefs - list to which soft references are appendedpublic void scaleDistance(double s)
ScalableUnitsscaleDistance in interface ScalableUnitss - scaling factorpublic void scaleMass(double s)
ScalableUnitsscaleMass in interface ScalableUnitss - scaling factorpublic PointSkinAttachment copy(int flags, java.util.Map<ModelComponent,ModelComponent> copyMap)
CopyableComponentCOPY_REFERENCES
is set in flags, then any component referenced
by this component should itself be set to a copy. This
should be done first checking copyMap for an
existing copy of the referenced component. If there is no existing
copy, then a copy should be created by calling copy
recursively and adding the new copy to copyMap.copy in interface DynamicAttachmentCompcopy in interface CopyableComponentcopy in class PointAttachmentflags - flags to control the copyingcopyMap - map to possible existing instances of referenced
componentspublic void updateReferences(boolean undo,
java.util.Deque<java.lang.Object> undoInfo)
undo equal to false,
this component should then examine its soft references and
use ComponentUtils.areConnected()
to determine which of them have been disconnected from the hierarchy.
Disconnected references should be removed, and sufficient information
should be appended to undoInfo to allow this update
to be undone if this method is called later with undo
equal to true. When undoing an update, the undo
information should be removed from the front of undoInfo.updateReferences in interface ModelComponentupdateReferences in class ModelComponentBaseundo - if true, indicates that the most
recent reference update should be undone, using the supplied
undo information.undoInfo - if undo is false, should be used
to store information allowing the reference update to be undone.
Otherwise, if undo is true, then this
supplied information to undo the most recent update.public void connectToHierarchy(CompositeComponent hcomp)
DynamicAttachmentBaseconnectToHierarchy in interface ModelComponentconnectToHierarchy in class DynamicAttachmentBasehcomp - hierarchy component to which this component,
or its ancestor, was attachedpublic void disconnectFromHierarchy(CompositeComponent hcomp)
DynamicAttachmentBasedisconnectFromHierarchy in interface ModelComponentdisconnectFromHierarchy in class DynamicAttachmentBasehcomp - hierarchy component from which this component,
or its ancestor, was detachedpublic void transformGeometry(AffineTransform3dBase X)
TransformGeometryContext.transform (this, X, 0);
transformGeometry in interface TransformableGeometryX - affine transformation to apply to the componentpublic void transformGeometry(GeometryTransformer gtr, TransformGeometryContext context, int flags)
gtr to transform its individual attributes. The
context argument supplies information about what other
components are currently being transformed, and also allows the
requesting of update actions to be performed after all transform called
have completed. The context is also the usual entity that calls
this method, from within its TransformGeometryContext.apply(maspack.geometry.GeometryTransformer, int)
method. The argument flags provides flags to specify
various conditions associated with the the transformation.
At present, the available flags are TransformableGeometry.TG_SIMULATING and
TransformableGeometry.TG_ARTICULATED.
This method is not usually called directly by applications.
Instead, it is typically called from within the
TransformGeometryContext.apply(maspack.geometry.GeometryTransformer, int) method of the context,
which takes care of the various operations needed for a
complete transform operation, including calling
TransformableGeometry.addTransformableDependencies(artisynth.core.modelbase.TransformGeometryContext, int) to collect other
components that should be transformed, calling
TransformableGeometry.transformGeometry(maspack.matrix.AffineTransform3dBase) for each component, notifying
component parents that the geometry has changed, and calling
any requested TransformGeometryActions. More details
are given in the documentation for
TransformGeometryContext.apply(maspack.geometry.GeometryTransformer, int).
TransformGeometryContext provides a number of
static convenience transform methods
which take care of building the context and calling
apply() for a specified set of components.
This method should not
generally call transformGeometry() for its descendant
components. Instead, descendants needing transformation should be
specified by adding them to the context in the method TransformableGeometry.addTransformableDependencies(artisynth.core.modelbase.TransformGeometryContext, int).
transformGeometry in interface TransformableGeometrygtr - transformer implementing the transformcontext - context information, including what other components
are being transformedflags - specifies conditions associated with the transformationpublic void addTransformableDependencies(TransformGeometryContext context, int flags)
context any transformable components which should be
transformed as the same time as this component. This will generally
include descendant components, and may also include other components to
which this component is connected in some way.
This method is generally called from with the
TransformGeometryContext.apply(maspack.geometry.GeometryTransformer, int) method of a
TransformGeometryContext.
addTransformableDependencies in interface TransformableGeometrycontext - context information, to which the dependent components
are added.flags - specifies conditions associated with the transformationpublic void add1DConstraintBlocks(SparseBlockMatrix GT, int bj, double scale, ContactPoint cpnt, Vector3d dir)
ContactMasterbj,
while the block row(s) are determined internally by the solve indices of
the underlying dynamic components.add1DConstraintBlocks in interface ContactMasterGT - constraint matrixbj - block column indexscale - TODOcpnt - contact pointdir - friction directionpublic void add2DConstraintBlocks(SparseBlockMatrix GT, int bj, double scale, ContactPoint cpnt, Vector3d dir0, Vector3d dir1)
ContactMasterbj, while the block row(s) are determined internally
by the solve indices of the underlying dynamic components.add2DConstraintBlocks in interface ContactMasterGT - constraint matrixbj - block column indexscale - TODOcpnt - contact pointdir0 - first friction directiondir1 - second friction directionpublic void addRelativeVelocity(Vector3d vel, double scale, ContactPoint cpnt)
ContactMasteraddRelativeVelocity in interface ContactMastervel - accumulates velocityscale - TODOcpnt - contact pointpublic void computeForceOnMasters(VectorNd uvec, Vector3d fc, double scale, ContactPoint cpnt, SparseBlockMatrix S)
ContactMastercomputeForceOnMasters in interface ContactMasterpublic boolean isControllable()
ContactMasterisControllable in interface ContactMastertrue if at least one dynamic component is
controllablepublic int collectMasterComponents(java.util.HashSet<DynamicComponent> masters, boolean activeOnly)
ContactMastermasters, i.e., the number of components that were not already present
there.collectMasterComponents in interface ContactMastermasters - set to which the dynamic components should be addedactiveOnly - restrict collected components to those which are activepublic static void main(java.lang.String[] args)