public class MultiPointSpring extends PointSpringBase implements ScalableUnits, TransformableGeometry, CopyableComponent, RequiresPrePostAdvance, HasSlaveObjects, HasAuxState
ModelComponent.NavpanelVisibility
HasAuxState.StateContext
Modifier and Type | Field and Description |
---|---|
static boolean |
myDrawWrapPoints |
static boolean |
myIgnoreCoriolisInJacobian |
static PropertyList |
myProps |
useMaterial
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
ARTICULATED, SIMULATING
COPY_REFERENCES
TRANSLUCENT, TWO_DIMENSIONAL
Constructor and Description |
---|
MultiPointSpring() |
MultiPointSpring(double k,
double d,
double l) |
MultiPointSpring(java.lang.String name) |
MultiPointSpring(java.lang.String name,
double k,
double d,
double l) |
Modifier and Type | Method and Description |
---|---|
void |
addPoint(int idx,
Point pnt) |
void |
addPoint(Point pnt) |
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 |
addWrappable(Wrappable wrappable) |
void |
advanceAuxState(double t0,
double t1)
Called at the very beginning of the time step (in the system's
preadvance() method) to perform any required updating of the component's
state before the application in input probes or controllers.
|
void |
applyForces(double t)
Adds forces to the components affected by this force effector at a
particular time.
|
void |
clearPoints() |
void |
clearWrappables() |
double |
computeLength(boolean activeOnly) |
boolean |
containsPoint(Point pnt) |
boolean |
containsWrappable(Wrappable wrappable) |
ModelComponent |
copy(int flags,
java.util.Map<ModelComponent,ModelComponent> copyMap)
Create a copy of this component.
|
double |
getActiveLength() |
double |
getActiveLengthDot() |
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
void |
getAuxState(DataBuffer data)
Saves state information for this component by adding data to the
supplied DataBuffer.
|
double |
getContactDamping() |
double |
getContactStiffness() |
boolean |
getCopyReferences(java.util.List<ModelComponent> refs,
ModelComponent ancestor)
Collects external references which must also be copied in order to
duplicate this component.
|
boolean |
getDrawABPoints() |
boolean |
getDrawKnots() |
void |
getHardReferences(java.util.List<ModelComponent> refs)
Appends all hard references for this component to a list.
|
void |
getInitialAuxState(DataBuffer newData,
DataBuffer oldData)
Saves initial state information data for this component by adding data
to the supplied data buffer.
|
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 |
getLength() |
double |
getLengthConvTol() |
double |
getLengthDot() |
int |
getMaxWrapIterations() |
Point |
getPoint(int idx) |
void |
getSoftReferences(java.util.List<ModelComponent> refs)
Appends all soft references for this component to a list.
|
double |
getWrapDamping() |
Wrappable |
getWrappable(int idx) |
double |
getWrapStiffness() |
int |
indexOfPoint(Point pnt) |
int |
indexOfWrappable(Wrappable wrappable) |
boolean |
isDuplicatable()
Returns true if this component can be duplicated.
|
boolean |
isSegmentPassive(int segIdx) |
int |
numPassiveSegments() |
int |
numPoints() |
int |
numWrappables() |
void |
postadvance(double t0,
double t1,
int flags)
Called from within the model's
advance() method, after all position and velocity state has been
advanced. |
void |
preadvance(double t0,
double t1,
int flags)
Called from within the model's
preadvance() method. |
void |
prerender(RenderList list)
Prepare for rendering, and potentially add itself to a list to be drawn
by a GLRenderer.
|
boolean |
removePoint(Point pnt) |
boolean |
removeWrappable(Wrappable wrappable) |
void |
render(GLRenderer renderer,
int flags)
Render this object using Open GL via the JOGL.
|
void |
scaleDistance(double s)
Scales all distance coordinates.
|
void |
scaleMass(double s)
Scales all mass units.
|
void |
scan(ReaderTokenizer rtok,
java.lang.Object ref)
Scans this element from a ReaderTokenizer.
|
void |
setAuxState(DataBuffer data)
Restores the state for this component by reading from the supplied
data buffer, starting at the current buffer offsets.
|
void |
setContactDamping(double damping) |
void |
setContactStiffness(double stiffness) |
void |
setDrawABPoints(boolean enable) |
void |
setDrawKnots(boolean enable) |
void |
setLengthConvTol(double h) |
void |
setMaxWrapIterations(int num) |
void |
setPoint(Point pnt,
int idx) |
double |
setRestLengthFromPoints()
Sets the rest length of the spring from the current point locations
|
void |
setSegmentPassive(int segIdx,
boolean passive) |
void |
setSegmentWrappable(int numk) |
void |
setSegmentWrappable(int numk,
Point3d[] initialPnts) |
void |
setWrapDamping(double damping) |
void |
setWrapStiffness(double stiffness) |
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 |
transformGeometry(AffineTransform3dBase X)
Applies an affine transformation to the geometry of this object.
|
void |
transformGeometry(AffineTransform3dBase X,
TransformableGeometry topObject,
int flags)
Applies an affine transformation to the geometry of this object.
|
void |
updateBounds(Point3d pmin,
Point3d 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.
|
void |
updateSlavePos()
Called when the system's dynamic position state changes, to update the
position state of the slave objects.
|
void |
updateSlaveVel()
Called when the system's dynamic velocity state changes, to update the
velocity state of the slave objects.
|
void |
updateStructure()
Hook method to allow sub-classes to update their structure by adding
or removing points.
|
void |
updateWrapSegments()
Applies one iteration of the wrap segment updating method.
|
computeDFdl, computeDFdldot, computeF, createDefaultMaterial, createRenderProps, getEffectiveMaterial, getMaterial, getMaxForce, getRenderColor, getRenderHints, getRenderProps, getRestLength, getSelection, isSelectable, numSelectionQueriesNeeded, setDamping, setLinearMaterial, setMaterial, setMaxForce, setRenderProps, setRestLength, setStiffness
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getChildren, getGrandParent, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, hasChildren, hasState, isConnectedToHierarchy, isFixed, isMarked, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, postscan, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setSelected, write
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
connectToHierarchy, disconnectFromHierarchy, getName, getNavpanelVisibility, getNumber, getParent, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, postscan, setFixed, setMarked, setName, setNumber, setParent, setSelected
getProperty
getChildren, hasChildren
isWritable, write
public static boolean myIgnoreCoriolisInJacobian
public static boolean myDrawWrapPoints
public static PropertyList myProps
public MultiPointSpring()
public MultiPointSpring(java.lang.String name)
public MultiPointSpring(java.lang.String name, double k, double d, double l)
public MultiPointSpring(double k, double d, double l)
public double getWrapStiffness()
public void setWrapStiffness(double stiffness)
public int getMaxWrapIterations()
public void setMaxWrapIterations(int num)
public double getWrapDamping()
public void setWrapDamping(double damping)
public double getContactStiffness()
public void setContactStiffness(double stiffness)
public double getContactDamping()
public void setContactDamping(double damping)
public double getLengthConvTol()
public void setLengthConvTol(double h)
public boolean getDrawKnots()
public void setDrawKnots(boolean enable)
public boolean getDrawABPoints()
public void setDrawABPoints(boolean enable)
public PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class PointSpringBase
public double setRestLengthFromPoints()
setRestLengthFromPoints
in class PointSpringBase
public void setSegmentPassive(int segIdx, boolean passive)
public int numPassiveSegments()
public boolean isSegmentPassive(int segIdx)
public void applyForces(double t)
ForceEffector
applyForces
in interface ForceEffector
applyForces
in class Spring
t
- time (seconds)public void scan(ReaderTokenizer rtok, java.lang.Object ref) throws java.io.IOException
ModelComponentBase
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 updateBounds(Point3d pmin, Point3d pmax)
GLRenderable
updateBounds
in interface GLRenderable
updateBounds
in class PointSpringBase
pmin
- minimum pointpmax
- maximum pointpublic void prerender(RenderList list)
GLRenderable
prerender
in interface GLRenderable
prerender
in class PointSpringBase
public void render(GLRenderer renderer, int flags)
GLRenderable
render
in interface GLRenderable
render
in class PointSpringBase
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
.public void scaleDistance(double s)
ScalableUnits
scaleDistance
in interface ScalableUnits
scaleDistance
in class PointSpringBase
s
- scaling factorpublic void scaleMass(double s)
ScalableUnits
scaleMass
in interface ScalableUnits
scaleMass
in class PointSpringBase
s
- scaling factorpublic void transformGeometry(AffineTransform3dBase X)
TransformableGeometry
transformGeometry (X, this, 0);
transformGeometry
in interface TransformableGeometry
X
- affine transformationpublic void transformGeometry(AffineTransform3dBase X, TransformableGeometry topObject, int flags)
TransformableGeometry
topComponent
should be the component for which the method
was initially invoked. The variable flags
provides
information about the context in which the transformation is
being applied. At present, the available flags are
TransformableGeometry.SIMULATING
and TransformableGeometry.ARTICULATED
.transformGeometry
in interface TransformableGeometry
X
- affine transformationtopObject
- component on which the method was initially invokedflags
- provides information about the context in which the
transformation is being applied.public double computeLength(boolean activeOnly)
public double getActiveLengthDot()
public double getLengthDot()
public double getActiveLength()
public double getLength()
getLength
in class PointSpringBase
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 boolean isDuplicatable()
true
if and only if CopyableComponent.getCopyReferences(java.util.List<artisynth.core.modelbase.ModelComponent>, artisynth.core.modelbase.ModelComponent)
returns true.
This method is not currently used. It is intended to provide a faster
way of determining if a component can be duplicated, without having to
use CopyableComponent.getCopyReferences(java.util.List<artisynth.core.modelbase.ModelComponent>, artisynth.core.modelbase.ModelComponent)
to build the list of copy references.
isDuplicatable
in interface CopyableComponent
true
if this component can be duplicated.public boolean getCopyReferences(java.util.List<ModelComponent> refs, ModelComponent ancestor)
true
if and only if CopyableComponent.isDuplicatable()
returns
true.getCopyReferences
in interface CopyableComponent
refs
- list to which references are appendedancestor
- root node of the hierarchy from which references are to be excludedpublic ModelComponent copy(int flags, java.util.Map<ModelComponent,ModelComponent> copyMap)
CopyableComponent
COPY_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 CopyableComponent
copy
in class PointSpringBase
public void getHardReferences(java.util.List<ModelComponent> refs)
ModelComponentBase
getHardReferences
in interface ModelComponent
getHardReferences
in class ModelComponentBase
refs
- list to which hard references are appendedpublic void getSoftReferences(java.util.List<ModelComponent> refs)
ModelComponentBase
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)
ModelComponentBase
undo
equal to false
,
this component should then examine its soft references and
use ComponentUtils.isConnected()
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.public void preadvance(double t0, double t1, int flags)
RequiresPrePostAdvance
preadvance()
method.preadvance
in interface RequiresPrePostAdvance
t0
- current time (seconds)t1
- new time to be advanced to (seconds)flags
- flags passed to the model's
preadvance()
method (reserved for future use).public void postadvance(double t0, double t1, int flags)
RequiresPrePostAdvance
advance()
method, after all position and velocity state has been
advanced.postadvance
in interface RequiresPrePostAdvance
t0
- current time (seconds)t1
- new time to be advanced to (seconds)flags
- flags passed to the model's
advance()
method (reserved for future use).public void updateStructure()
public void updateSlavePos()
HasSlaveObjects
updateSlavePos
in interface HasSlaveObjects
public void updateSlaveVel()
HasSlaveObjects
updateSlaveVel
in interface HasSlaveObjects
public void advanceAuxState(double t0, double t1)
HasAuxState
advanceAuxState
in interface HasAuxState
t0
- beginning time associated with the time step advancet1
- end time associated with the time step advancepublic void skipAuxState(DataBuffer data)
HasAuxState
skipAuxState
in interface HasAuxState
data
- buffer containing the state informationpublic void getAuxState(DataBuffer data)
HasAuxState
getAuxState
in interface HasAuxState
data
- buffer for storing the state values.public void getInitialAuxState(DataBuffer newData, DataBuffer oldData)
HasAuxState
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.
getInitialAuxState
in interface HasAuxState
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.public void setAuxState(DataBuffer data)
HasAuxState
setAuxState
in interface HasAuxState
data
- buffer containing the state informationpublic void addPoint(int idx, Point pnt)
public void addPoint(Point pnt)
public Point getPoint(int idx)
public int numPoints()
public int indexOfPoint(Point pnt)
public boolean containsPoint(Point pnt)
public void setPoint(Point pnt, int idx)
public boolean removePoint(Point pnt)
public void clearPoints()
public void setSegmentWrappable(int numk)
public void setSegmentWrappable(int numk, Point3d[] initialPnts)
public void addWrappable(Wrappable wrappable)
public boolean containsWrappable(Wrappable wrappable)
public int numWrappables()
public int indexOfWrappable(Wrappable wrappable)
public Wrappable getWrappable(int idx)
public boolean removeWrappable(Wrappable wrappable)
public void clearWrappables()
public void updateWrapSegments()