public class BackNode3d extends DynamicComponentBase implements MotionTargetComponent
ModelComponent.NavpanelVisibility
Modifier and Type | Field and Description |
---|---|
static PropertyList |
myProps |
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
TG_ARTICULATED, TG_DRAGGER, TG_PRESERVE_ORIENTATION, TG_SIMULATING
TRANSPARENT, TWO_DIMENSIONAL
Constructor and Description |
---|
BackNode3d(FemNode3d node) |
Modifier and Type | Method and Description |
---|---|
void |
addEffectiveMass(double m) |
int |
addForce(double[] buf,
int idx) |
void |
addForce(Vector3d f) |
void |
addPosImpulse(double[] xbuf,
int xidx,
double h,
double[] vbuf,
int vidx) |
void |
addPosJacobian(SparseNumberedBlockMatrix M,
double s)
Scales the components of the position Jacobian associated with this force
effector and adds it to the supplied solve matrix M.
|
void |
addScaledForce(double s,
Vector3d f) |
void |
addSolveBlock(SparseNumberedBlockMatrix S) |
void |
addSolveBlocks(SparseNumberedBlockMatrix M)
Adds any needed blocks to a solve matrix in order to accomodate the
Jacobian terms associated with this force effector.
|
int |
addTargetJacobian(SparseBlockMatrix J,
int bi)
Add a row to the motion target Jacobian for this motion target.
|
void |
addTransformableDependencies(TransformGeometryContext context,
int flags)
Adds to
context any transformable components which should be
transformed as the same time as this component. |
void |
addVelJacobian(SparseNumberedBlockMatrix M,
double s)
Scales the components of the velocity Jacobian associated with this force
effector and adds it to the supplied solve matrix M.
|
void |
applyExternalForces() |
void |
applyForces(double t)
Adds forces to the components affected by this force effector at a
particular time.
|
void |
applyGravity(Vector3d gacc)
Note: this method is required by the interface, but is not currently
used since gravity is applied directly to nodes within
FemModel3d.updateNodeForces(), and gravity action is lumped
together with the front node.
|
void |
clearPosition() |
void |
clearRestPosition() |
BackNode3d |
copy(int flags,
java.util.Map<ModelComponent,ModelComponent> copyMap) |
MatrixBlock |
createMassBlock()
Create a matrix block for representing the mass of this component,
initialized to the component's effective mass (instrinsic mass
plus the mass due to all attachmented components).
|
boolean |
defaultRenderPropsAreNull() |
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
double |
getEffectiveMass()
Gets the effective scalar mass of this component.
|
void |
getEffectiveMass(Matrix M,
double t)
Gets the effective mass of this component at a particular time.
|
int |
getEffectiveMassForces(VectorNd f,
double t,
int idx)
Gets the mass forces for this component at a particular time.
|
Vector3d |
getForce() |
int |
getForce(double[] buf,
int idx) |
Vector3d |
getInternalForce() |
void |
getInverseMass(Matrix Minv,
Matrix M)
Inverts a mass for this component.
|
int |
getJacobianType()
Returns a code indicating the matrix type that results when the Jacobian
terms of this force effector are added to the solve matrix.
|
double |
getMass()
Returns the mass for this backnode.
|
double |
getMass(double t)
This method is required by the interface, but is not currently used.
|
void |
getMass(Matrix M,
double t)
This method is required by the interface, but is not currently used.
|
int |
getPosDerivative(double[] buf,
int idx) |
Point3d |
getPosition() |
int |
getPosState(double[] buf,
int idx) |
int |
getPosStateSize() |
float[] |
getRenderCoords() |
Point3d |
getRenderPosition() |
Point3d |
getRestPosition() |
void |
getState(DataBuffer data)
Saves state information for this component by adding data to the
supplied DataBuffer.
|
MotionTarget.TargetActivity |
getTargetActivity() |
int |
getTargetPos(double[] post,
double s,
double h,
int idx) |
int |
getTargetVel(double[] velt,
double s,
double h,
int idx) |
Vector3d |
getVelocity() |
int |
getVelState(double[] buf,
int idx) |
int |
getVelStateSize() |
boolean |
hasForce()
Queries whether or not this component actually exerts its own
state-dependent forces (typically associated with damping).
|
boolean |
isMassConstant() |
boolean |
isPositionValid() |
boolean |
isRestPositionExplicit() |
boolean |
isRestPositionValid() |
int |
mulInverseEffectiveMass(Matrix M,
double[] a,
double[] f,
int idx) |
void |
render(Renderer renderer,
int flags)
Render this object using the functionality of the supplied
Renderer . |
void |
resetEffectiveMass()
Resets the effective mass of this component to the nominal mass.
|
void |
resetTargets() |
void |
saveRenderCoords() |
void |
scalePosition(double s,
Point3d frontPos) |
void |
scaleRestPosition(double s,
Point3d frontRest) |
void |
scan(ReaderTokenizer rtok,
java.lang.Object ref)
Scans this element from a ReaderTokenizer.
|
void |
setDynamic(boolean enable) |
int |
setForce(double[] buf,
int idx) |
void |
setForce(Vector3d f) |
void |
setPosition(Point3d pos) |
void |
setPosition(Point3d frontPos,
Vector3d dir) |
void |
setPositionToRest() |
int |
setPosState(double[] buf,
int idx) |
void |
setRandomForce()
Sets the force of this component to a random value.
|
void |
setRandomPosState()
Sets the position state of this component to a random value.
|
void |
setRandomVelState()
Sets the velocity state of this component to a random value.
|
void |
setRestPosition(Point3d rest) |
void |
setRestPosition(Point3d frontRest,
Vector3d restDir) |
void |
setState(DataBuffer data)
Restores the state for this component by reading from the supplied
data buffer, starting at the current buffer offsets.
|
void |
setTargetActivity(MotionTarget.TargetActivity activity) |
void |
setVelocity(Vector3d vel) |
int |
setVelState(double[] buf,
int idx) |
void |
subForce(Vector3d f) |
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. |
boolean |
velocityLimitExceeded(double tlimit,
double rlimit)
Checks if the current component velocity exceeds specified limits.
|
void |
zeroExternalForces() |
void |
zeroForces() |
addAttachmentRequest, addConstrainer, addMasterAttachment, connectToHierarchy, disconnectFromHierarchy, getAttachment, getConstrainers, getMasterAttachments, getSolveIndex, hasState, isActive, isAttached, isControllable, isDynamic, isParametric, removeAttachmentRequest, removeConstrainer, removeMasterAttachment, setAttached, setSolveIndex
createRenderProps, getRenderHints, getRenderProps, getSelection, isSelectable, isVisible, numSelectionQueriesNeeded, prerender, setRenderProps, setVisible, updateBounds, updateRenderProps
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, createTempFlag, 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, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setScanning, setSelected, setWritable, updateReferences, write
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addAttachmentRequest, removeAttachmentRequest
addConstrainer, addMasterAttachment, getAttachment, getConstrainers, getMasterAttachments, getSolveIndex, isActive, isAttached, isControllable, isDynamic, isParametric, removeConstrainer, removeMasterAttachment, setAttached, setSolveIndex
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
transformPriority
public static PropertyList myProps
public BackNode3d(FemNode3d node)
public PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class RenderableComponentBase
public Point3d getPosition()
public void setPosition(Point3d pos)
public void scalePosition(double s, Point3d frontPos)
public void clearPosition()
public boolean isPositionValid()
public void setPositionToRest()
public Vector3d getVelocity()
public void setVelocity(Vector3d vel)
public Point3d getRestPosition()
public void setRestPosition(Point3d rest)
public void scaleRestPosition(double s, Point3d frontRest)
public void clearRestPosition()
public boolean isRestPositionExplicit()
public boolean isRestPositionValid()
public Point3d getRenderPosition()
public Vector3d getForce()
public void setForce(Vector3d f)
public void addForce(Vector3d f)
public void addScaledForce(double s, Vector3d f)
public void subForce(Vector3d f)
public Vector3d getInternalForce()
public MatrixBlock createMassBlock()
createMassBlock
in interface DynamicAgent
public boolean isMassConstant()
isMassConstant
in interface DynamicAgent
public double getMass(double t)
getMass
in interface DynamicAgent
public double getMass()
If computed from density, the back node's mass is half of the total nodal mass due to shell elements. Otherwise, if the front node's mass is explicitly set, the back node's mass is set to half the front node mass.
public void getMass(Matrix M, double t)
getMass
in interface DynamicAgent
M
- matrix to return the mass int
- current timepublic int getEffectiveMassForces(VectorNd f, double t, int idx)
f
, starting at the location
specified by idx
. Upon return, this method should
return the value of idx
incremented by the dimension
of the mass forces.getEffectiveMassForces
in interface DynamicAgent
f
- vector to return the forces int
- current timeidx
- starting location within f
where forces should be storedidx
public void getInverseMass(Matrix Minv, Matrix M)
getInverseMass
in interface DynamicAgent
getInverseMass
in class DynamicComponentBase
Minv
- matrix to return the inverse mass inM
- matrix containing the mass to be invertedpublic void resetEffectiveMass()
resetEffectiveMass
in interface DynamicAgent
public void addEffectiveMass(double m)
public void getEffectiveMass(Matrix M, double t)
getEffectiveMass
in interface DynamicAgent
M
- matrix to return the mass int
- current timepublic double getEffectiveMass()
getEffectiveMass
in interface DynamicAgent
public int mulInverseEffectiveMass(Matrix M, double[] a, double[] f, int idx)
mulInverseEffectiveMass
in interface DynamicAgent
public void addSolveBlock(SparseNumberedBlockMatrix S)
addSolveBlock
in interface DynamicAgent
addSolveBlock
in class DynamicComponentBase
public void addPosImpulse(double[] xbuf, int xidx, double h, double[] vbuf, int vidx)
addPosImpulse
in interface DynamicAgent
public int getPosDerivative(double[] buf, int idx)
getPosDerivative
in interface DynamicAgent
public int getPosState(double[] buf, int idx)
getPosState
in interface DynamicAgent
public int setPosState(double[] buf, int idx)
setPosState
in interface DynamicAgent
public int getVelState(double[] buf, int idx)
getVelState
in interface DynamicAgent
public int setVelState(double[] buf, int idx)
setVelState
in interface DynamicAgent
public int setForce(double[] buf, int idx)
setForce
in interface DynamicAgent
public int addForce(double[] buf, int idx)
addForce
in interface DynamicAgent
public int getForce(double[] buf, int idx)
getForce
in interface DynamicAgent
public int getPosStateSize()
getPosStateSize
in interface DynamicAgent
getPosStateSize
in interface MotionTargetComponent
public int getVelStateSize()
getVelStateSize
in interface DynamicAgent
getVelStateSize
in interface MotionTargetComponent
public void zeroForces()
zeroForces
in interface DynamicAgent
public void zeroExternalForces()
zeroExternalForces
in interface DynamicAgent
public void applyExternalForces()
applyExternalForces
in interface DynamicAgent
public boolean velocityLimitExceeded(double tlimit, double rlimit)
DynamicAgent
velocityLimitExceeded
in interface DynamicAgent
tlimit
- translational velocity limitrlimit
- rotational velocity limitpublic void applyGravity(Vector3d gacc)
applyGravity
in interface DynamicAgent
public boolean hasForce()
DynamicAgent
Any action that alters the return value of this method should
propagate a StructureChangeEvent
. This can be
a state-not-changed event if component's state structure
is not altered (which it typically won't be).
hasForce
in interface DynamicAgent
true
if this component exerts its own forces.public void getState(DataBuffer data)
HasNumericState
getState
in interface DynamicAgent
getState
in interface HasNumericState
data
- buffer for storing the state values.public void setState(DataBuffer data)
HasNumericState
setState
in interface DynamicAgent
setState
in interface HasNumericState
data
- buffer containing the state informationpublic void setRandomPosState()
DynamicAgent
setRandomPosState
in interface DynamicAgent
public void setRandomVelState()
DynamicAgent
setRandomVelState
in interface DynamicAgent
public void setRandomForce()
DynamicAgent
setRandomForce
in interface DynamicAgent
public void applyForces(double t)
ForceEffector
applyForces
in interface ForceEffector
t
- time (seconds)public void addSolveBlocks(SparseNumberedBlockMatrix M)
ForceEffector
getSolveIndex
) for all dynamic or attached components affected by this
force effector.addSolveBlocks
in interface ForceEffector
M
- solve matrix to which blocks should be addedpublic void addPosJacobian(SparseNumberedBlockMatrix M, double s)
ForceEffector
M is guaranteed to be the same matrix supplied in the most recent call to
addSolveBlocks
, and so implementations may choose
to cache the relevant matrix blocks from that call, instead of retrieving
them directly from M.
addPosJacobian
in interface ForceEffector
M
- solve matrix to which scaled position Jacobian is to be addeds
- scaling factor for position Jacobianpublic void addVelJacobian(SparseNumberedBlockMatrix M, double s)
ForceEffector
M is guaranteed to be the same matrix supplied in the most recent call to
addSolveBlocks
, and so implementations may choose
to cache the relevant matrix blocks from that call, instead of retrieving
them directly from M.
addVelJacobian
in interface ForceEffector
M
- solve matrix to which scaled velocity Jacobian is to be addeds
- scaling factor for velocity Jacobianpublic int getJacobianType()
ForceEffector
Matrix.SYMMETRIC
or Matrix.POSITIVE_DEFINITE
. The former should be set if adding the Jacobian
terms preserves symmetry, and the latter should be set if positive
definiteness if preserved. Both should be set if there is no Jacobian for
this effector (i.e., the Jacobian methods are not implemented). Matrix
types from all the force effectors are logically and-ed together to
determine the type for the entire solve matrix.getJacobianType
in interface ForceEffector
public void transformGeometry(AffineTransform3dBase X)
TransformableGeometry
TransformGeometryContext.transform (this, X, 0);
transformGeometry
in interface TransformableGeometry
transformGeometry
in class DynamicComponentBase
X
- affine transformation to apply to the componentpublic void transformGeometry(GeometryTransformer gtr, TransformGeometryContext context, int flags)
TransformableGeometry
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 TransformGeometryAction
s. 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 TransformableGeometry
transformGeometry
in class DynamicComponentBase
gtr
- 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)
TransformableGeometry
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 TransformableGeometry
addTransformableDependencies
in class DynamicComponentBase
context
- context information, to which the dependent components
are added.flags
- specifies conditions associated with the transformationpublic boolean defaultRenderPropsAreNull()
defaultRenderPropsAreNull
in class RenderableComponentBase
public void render(Renderer renderer, int flags)
IsRenderable
Renderer
.render
in interface IsRenderable
render
in class RenderableComponentBase
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 setDynamic(boolean enable)
public MotionTarget.TargetActivity getTargetActivity()
getTargetActivity
in interface MotionTargetComponent
public void setTargetActivity(MotionTarget.TargetActivity activity)
setTargetActivity
in interface MotionTargetComponent
public int getTargetVel(double[] velt, double s, double h, int idx)
getTargetVel
in interface MotionTargetComponent
public int getTargetPos(double[] post, double s, double h, int idx)
getTargetPos
in interface MotionTargetComponent
public int addTargetJacobian(SparseBlockMatrix J, int bi)
MotionTargetComponent
vt = J u
addTargetJacobian
in interface MotionTargetComponent
J
- motion target Jacobianbi
- block row index for the row to be addedpublic void resetTargets()
resetTargets
in interface MotionTargetComponent
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 ModelComponentBase
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 saveRenderCoords()
public float[] getRenderCoords()
public BackNode3d copy(int flags, java.util.Map<ModelComponent,ModelComponent> copyMap)
copy
in class DynamicComponentBase