public class PointMeshForce extends RenderableComponentBase implements ForceComponent
MeshComponent
.Modifier and Type | Class and Description |
---|---|
static class |
PointMeshForce.ForceType
Determines force on the mesh-interacting points are computed in response
to the point's distance from the mesh
|
ModelComponent.NavpanelVisibility
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_DAMPING |
static boolean |
DEFAULT_ENABLED |
static PointMeshForce.ForceType |
DEFAULT_FORCE_TYPE |
static double |
DEFAULT_STIFFNESS |
static boolean |
DEFAULT_UNILATERAL |
static PropertyList |
myProps |
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
TRANSPARENT, TWO_DIMENSIONAL
Constructor and Description |
---|
PointMeshForce()
This constructor should not be called by applications, unless
ModelComponentBase.scan(maspack.util.ReaderTokenizer, java.lang.Object) is called immediately after. |
PointMeshForce(MeshComponent mcomp)
Creates a new PointMeshForce for a mesh contained within a specified
mesh component.
|
PointMeshForce(java.lang.String name,
MeshComponent mcomp)
Creates a new PointMeshForce for a mesh contained within a specified
mesh component.
|
PointMeshForce(java.lang.String name,
MeshComponent mcomp,
double stiffness,
double damping)
Creates a new PointMeshForce for a mesh contained within a specified
mesh component.
|
Modifier and Type | Method and Description |
---|---|
void |
addPoint(Point point)
Adds a mesh-interacting point to this PointMeshForce.
|
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 |
addSolveBlocks(SparseNumberedBlockMatrix M)
Adds any needed blocks to a solve matrix in order to accomodate the
Jacobian terms associated with this force effector.
|
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 |
applyForces(double t)
Adds forces to the components affected by this force effector at a
particular time.
|
void |
clearAllPoints()
Removes all mesh-interacting points from this PointMeshForce.
|
void |
computePointForce(Vector3d f,
int idx)
Computes the force currently acting on a specific point.
|
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
double |
getDamping()
Queries the damping force term for this PointMeshForce.
|
boolean |
getEnabled()
Queries whether this PointMeshForce is enabled.
|
PointMeshForce.ForceType |
getForceType()
Queries the force type for this PointMeshForce.
|
void |
getHardReferences(java.util.List<ModelComponent> refs)
Appends all hard references for this component to a list.
|
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.
|
MeshComponent |
getMeshComp()
Returns the mesh component containing the mesh.
|
Point |
getPoint(int idx)
Gets the
idx -th mesh-interacting point in this PointMeshForce. |
void |
getSoftReferences(java.util.List<ModelComponent> refs)
Appends all soft references for this component to a list.
|
double |
getStiffness()
Queries the stiffness force term for this PointMeshForce.
|
boolean |
getUnilateral()
Queries whether the point-mesh interactions are unilateral.
|
int |
numPoints()
Queries the number of mesh-interacting in this PointMeshForce.
|
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).
|
boolean |
removePoint(Point point)
Removes a mesh-interacting point from this PointMeshForce.
|
void |
render(Renderer renderer,
int flags)
Render this object using the functionality of the supplied
Renderer . |
void |
setDamping(double damping)
Sets the damping force term for this PointMeshForce.
|
void |
setEnabled(boolean enabled)
Sets whether this PointMeshForce is enabled.
|
void |
setForceType(PointMeshForce.ForceType type)
Sets the force type for this PointMeshForce.
|
void |
setStiffness(double stiffness)
Sets the stiffness force term for this PointMeshForce.
|
void |
setUnilateral(boolean enable)
Sets whether the point-mesh interactions are unilateral.
|
void |
updateBounds(Vector3d pmin,
Vector3d pmax)
Update the minimum and maximum points for this object.
|
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.
|
copy, createRenderProps, defaultRenderPropsAreNull, getRenderHints, getRenderProps, getSelection, isSelectable, isVisible, numSelectionQueriesNeeded, setRenderProps, setVisible, updateRenderProps
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getChildren, getGrandParent, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, 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, write
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
connectToHierarchy, disconnectFromHierarchy, getName, getNavpanelVisibility, getNumber, getParent, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, setWritable
getProperty
getChildren, hasChildren
postscan
isWritable, write
public static boolean DEFAULT_UNILATERAL
public static double DEFAULT_STIFFNESS
public static double DEFAULT_DAMPING
public static PointMeshForce.ForceType DEFAULT_FORCE_TYPE
public static boolean DEFAULT_ENABLED
public static PropertyList myProps
public PointMeshForce()
ModelComponentBase.scan(maspack.util.ReaderTokenizer, java.lang.Object)
is called immediately after.public PointMeshForce(MeshComponent mcomp)
mcomp
- contains the meshpublic PointMeshForce(java.lang.String name, MeshComponent mcomp)
name
- name of the PointMeshForce componentmcomp
- contains the meshpublic PointMeshForce(java.lang.String name, MeshComponent mcomp, double stiffness, double damping)
name
- name of the PointMeshForce componentmcomp
- contains the meshstiffness
- contact stiffness termdamping
- contact damping termpublic PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class RenderableComponentBase
public MeshComponent getMeshComp()
public void addPoint(Point point)
point
- point to addpublic boolean removePoint(Point point)
point
- point to removepublic int numPoints()
public Point getPoint(int idx)
idx
-th mesh-interacting point in this PointMeshForce.idx
- index of the requested pointpublic void clearAllPoints()
public boolean getUnilateral()
setUnilateral(boolean)
.true
if the point-mesh interactions are unilateralpublic void setUnilateral(boolean enable)
enable
- if true
, enables unilateral point-mesh
interactions.public PointMeshForce.ForceType getForceType()
setForceType(artisynth.core.mechmodels.PointMeshForce.ForceType)
.public void setForceType(PointMeshForce.ForceType type)
PointMeshForce.ForceType
and determines how the point forces are computed in
response to their distance from the mesh.type
- new force typepublic double getStiffness()
public void setStiffness(double stiffness)
stiffness
- new stiffness term valuepublic double getDamping()
public void setDamping(double damping)
damping
- new damping term valuepublic boolean getEnabled()
true
if this PointMeshForce is enabledpublic void setEnabled(boolean enabled)
enabled
- if true
, enables this PointMeshForcepublic void applyForces(double t)
applyForces
in interface ForceEffector
t
- time (seconds)public void computePointForce(Vector3d f, int idx)
f
- returns the computed force acting on the pointidx
- index of the pointpublic void addSolveBlocks(SparseNumberedBlockMatrix M)
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)
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)
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()
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 updateBounds(Vector3d pmin, Vector3d pmax)
updateBounds
in interface IsRenderable
updateBounds
in class RenderableComponentBase
pmin
- minimum pointpmax
- maximum pointpublic void prerender(RenderList list)
list.addIfVisible (obj);
for each of the objects in question.prerender
in interface IsRenderable
prerender
in class RenderableComponentBase
list
- list of objects to be renderedpublic void render(Renderer renderer, int flags)
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 getHardReferences(java.util.List<ModelComponent> refs)
getHardReferences
in interface ModelComponent
getHardReferences
in class ModelComponentBase
refs
- list to which hard references are appendedpublic void getSoftReferences(java.util.List<ModelComponent> refs)
updateReferences()
method will
be called to update its internal reference information.getSoftReferences
in interface ModelComponent
getSoftReferences
in class ModelComponentBase
refs
- list to which soft references are appendedpublic 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 ModelComponent
updateReferences
in class ModelComponentBase
undo
- 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.