artisynth.core.mechmodels
Class ParticleMeshConstraint

java.lang.Object
  extended by artisynth.core.modelbase.ModelComponentBase
      extended by artisynth.core.modelbase.RenderableComponentBase
          extended by artisynth.core.mechmodels.ConstrainerBase
              extended by artisynth.core.mechmodels.ParticleMeshConstraint
All Implemented Interfaces:
Constrainer, HasAuxState, ModelComponent, RenderableComponent, ScalableUnits, TransformableGeometry, java.lang.Cloneable, HasProperties, HierarchyNode, GLRenderable, GLSelectable, HasRenderProps, Renderable, Scannable

public class ParticleMeshConstraint
extends ConstrainerBase
implements ScalableUnits, TransformableGeometry

NOTE: This class is still under construction. scaleDistance(), transformGeometry(), and scan() and write() are unlikely to work properly.


Nested Class Summary
 
Nested classes/interfaces inherited from interface artisynth.core.mechmodels.HasAuxState
HasAuxState.StateContext
 
Nested classes/interfaces inherited from interface artisynth.core.modelbase.ModelComponent
ModelComponent.NavpanelVisibility
 
Field Summary
static PropertyList myProps
           
 
Fields inherited from class artisynth.core.modelbase.ModelComponentBase
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
 
Fields inherited from interface artisynth.core.util.TransformableGeometry
ARTICULATED, SIMULATING
 
Fields inherited from interface maspack.render.GLRenderable
TRANSLUCENT, TWO_DIMENSIONAL
 
Constructor Summary
ParticleMeshConstraint()
           
ParticleMeshConstraint(Particle p, PolygonalMesh mesh)
           
ParticleMeshConstraint(Particle p, PolygonalMesh mesh, java.lang.String fileName)
           
 
Method Summary
 int addBilateralConstraints(SparseBlockMatrix GT, VectorNd dg, int numb, IntHolder changeCnt)
           
 int addUnilateralConstraints(SparseBlockMatrix NT, VectorNd dn, int numu, IntHolder changeCnt)
           
 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.
 int getBilateralImpulses(VectorNd lam, int idx)
           
 int getBilateralInfo(MechSystem.ConstraintInfo[] ginfo, int idx)
           
 void getBilateralSizes(VectorNi sizes)
           
 double getCompliance()
           
 double getDamping()
           
 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.
 PolygonalMesh getMesh()
           
 boolean getNagataInterpolation()
           
 Particle getParticle()
           
 double getPenetrationTol()
           
 int getUnilateralImpulses(VectorNd the, int idx)
           
 int getUnilateralInfo(MechSystem.ConstraintInfo[] ninfo, int idx)
           
 void getUnilateralSizes(VectorNi sizes)
           
 boolean isUnilateral()
           
 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 setAuxState(DataBuffer data)
          Restores the state for this component by reading from the supplied data buffer, starting at the current buffer offsets.
 int setBilateralImpulses(VectorNd lam, double h, int idx)
           
 void setCompliance(double c)
           
 void setDamping(double d)
           
 void setDefaultValues()
          Sets the attributes of this component to their default values.
 void setMesh(PolygonalMesh mesh, java.lang.String fileName, AffineTransform3dBase X)
           
 void setNagataInterpolation(NagataInterpolator interp)
           
 void setPenetrationTol(double tol)
           
 void setUnilateral(boolean unilateral)
           
 int setUnilateralImpulses(VectorNd the, double h, int idx)
           
 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 min, Point3d max)
          Update the minimum and maximum points for this object.
 double updateConstraints(double t, int flags)
           
 void zeroImpulses()
           
 
Methods inherited from class artisynth.core.mechmodels.ConstrainerBase
addFrictionConstraints, advanceAuxState, hasState, maxFrictionConstraintSets
 
Methods inherited from class artisynth.core.modelbase.RenderableComponentBase
copy, createRenderProps, getRenderHints, getRenderProps, getSelection, isSelectable, numSelectionQueriesNeeded, prerender, setRenderProps, updateRenderProps
 
Methods inherited from class artisynth.core.modelbase.ModelComponentBase
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getChildren, getGrandParent, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, hasChildren, isFixed, isMarked, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, postscan, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, scan, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setSelected, updateReferences, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface artisynth.core.modelbase.ModelComponent
connectToHierarchy, disconnectFromHierarchy, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, isFixed, isMarked, isSelected, notifyParentOfChange, postscan, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, updateReferences
 
Methods inherited from interface maspack.properties.HasProperties
getProperty
 
Methods inherited from interface maspack.properties.HierarchyNode
getChildren, hasChildren
 
Methods inherited from interface maspack.util.Scannable
isWritable, write
 

Field Detail

myProps

public static PropertyList myProps
Constructor Detail

ParticleMeshConstraint

public ParticleMeshConstraint()

ParticleMeshConstraint

public ParticleMeshConstraint(Particle p,
                              PolygonalMesh mesh)

ParticleMeshConstraint

public ParticleMeshConstraint(Particle p,
                              PolygonalMesh mesh,
                              java.lang.String fileName)
Method Detail

getNagataInterpolation

public boolean getNagataInterpolation()

setNagataInterpolation

public void setNagataInterpolation(NagataInterpolator interp)

getAllPropertyInfo

public PropertyList getAllPropertyInfo()
Description copied from interface: HasProperties
Returns a list giving static information about all properties exported by this object.

Specified by:
getAllPropertyInfo in interface HasProperties
Overrides:
getAllPropertyInfo in class ModelComponentBase
Returns:
static information for all exported properties

setDefaultValues

public void setDefaultValues()
Description copied from class: ModelComponentBase
Sets the attributes of this component to their default values.


getDamping

public double getDamping()

setDamping

public void setDamping(double d)

getCompliance

public double getCompliance()

setCompliance

public void setCompliance(double c)

getPenetrationTol

public double getPenetrationTol()

setPenetrationTol

public void setPenetrationTol(double tol)

isUnilateral

public boolean isUnilateral()

setUnilateral

public void setUnilateral(boolean unilateral)

setMesh

public void setMesh(PolygonalMesh mesh,
                    java.lang.String fileName,
                    AffineTransform3dBase X)

getMesh

public PolygonalMesh getMesh()

getParticle

public Particle getParticle()

getBilateralSizes

public void getBilateralSizes(VectorNi sizes)
Specified by:
getBilateralSizes in interface Constrainer
Specified by:
getBilateralSizes in class ConstrainerBase

addBilateralConstraints

public int addBilateralConstraints(SparseBlockMatrix GT,
                                   VectorNd dg,
                                   int numb,
                                   IntHolder changeCnt)
Specified by:
addBilateralConstraints in interface Constrainer
Specified by:
addBilateralConstraints in class ConstrainerBase

getBilateralInfo

public int getBilateralInfo(MechSystem.ConstraintInfo[] ginfo,
                            int idx)
Specified by:
getBilateralInfo in interface Constrainer
Specified by:
getBilateralInfo in class ConstrainerBase

setBilateralImpulses

public int setBilateralImpulses(VectorNd lam,
                                double h,
                                int idx)
Specified by:
setBilateralImpulses in interface Constrainer
Specified by:
setBilateralImpulses in class ConstrainerBase

getBilateralImpulses

public int getBilateralImpulses(VectorNd lam,
                                int idx)
Specified by:
getBilateralImpulses in interface Constrainer
Specified by:
getBilateralImpulses in class ConstrainerBase

zeroImpulses

public void zeroImpulses()
Specified by:
zeroImpulses in interface Constrainer
Specified by:
zeroImpulses in class ConstrainerBase

getUnilateralSizes

public void getUnilateralSizes(VectorNi sizes)
Specified by:
getUnilateralSizes in interface Constrainer
Overrides:
getUnilateralSizes in class ConstrainerBase

addUnilateralConstraints

public int addUnilateralConstraints(SparseBlockMatrix NT,
                                    VectorNd dn,
                                    int numu,
                                    IntHolder changeCnt)
Specified by:
addUnilateralConstraints in interface Constrainer
Overrides:
addUnilateralConstraints in class ConstrainerBase

getUnilateralInfo

public int getUnilateralInfo(MechSystem.ConstraintInfo[] ninfo,
                             int idx)
Specified by:
getUnilateralInfo in interface Constrainer
Overrides:
getUnilateralInfo in class ConstrainerBase

getUnilateralImpulses

public int getUnilateralImpulses(VectorNd the,
                                 int idx)
Specified by:
getUnilateralImpulses in interface Constrainer
Overrides:
getUnilateralImpulses in class ConstrainerBase

setUnilateralImpulses

public int setUnilateralImpulses(VectorNd the,
                                 double h,
                                 int idx)
Specified by:
setUnilateralImpulses in interface Constrainer
Overrides:
setUnilateralImpulses in class ConstrainerBase

updateConstraints

public double updateConstraints(double t,
                                int flags)
Specified by:
updateConstraints in interface Constrainer
Specified by:
updateConstraints in class ConstrainerBase

getHardReferences

public void getHardReferences(java.util.List<ModelComponent> refs)
Description copied from class: ModelComponentBase
Appends all hard references for this component to a list. References are other components, outside of this component's immediate ancestry, on which this component depends. For example, an AxialSpring refers to two Point components as for it's end points. A hard reference is one which the referring component must have, and which if deleted, implies that the referring component should be deleted too.

Specified by:
getHardReferences in interface ModelComponent
Overrides:
getHardReferences in class ModelComponentBase
Parameters:
refs - list to which hard references are appended

updateBounds

public void updateBounds(Point3d min,
                         Point3d max)
Description copied from interface: GLRenderable
Update the minimum and maximum points for this object. In an x-y-z coordinate system with x directed to the right and y directed upwards, the minimum and maximum points can be thought of as defining the left-lower-far and right-upper-near corners of a bounding cube. This method should only reduce the elements of the minimum point and increase the elements of the maximum point, since it may be used as part of an iteration to determine the bounding cube for several different objects.

Specified by:
updateBounds in interface GLRenderable
Overrides:
updateBounds in class RenderableComponentBase
Parameters:
min - minimum point
max - maximum point

render

public void render(GLRenderer renderer,
                   int flags)
Description copied from interface: GLRenderable
Render this object using Open GL via the JOGL.

Specified by:
render in interface GLRenderable
Specified by:
render in class RenderableComponentBase
Parameters:
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.

scaleMass

public void scaleMass(double s)
Description copied from interface: ScalableUnits
Scales all mass units.

Specified by:
scaleMass in interface ScalableUnits
Parameters:
s - scaling factor

scaleDistance

public void scaleDistance(double s)
Description copied from interface: ScalableUnits
Scales all distance coordinates.

Specified by:
scaleDistance in interface ScalableUnits
Parameters:
s - scaling factor

transformGeometry

public void transformGeometry(AffineTransform3dBase X)
Description copied from interface: TransformableGeometry
Applies an affine transformation to the geometry of this object. This method should be equivalent to
 transformGeometry (X, this, 0);
 

Specified by:
transformGeometry in interface TransformableGeometry
Parameters:
X - affine transformation

transformGeometry

public void transformGeometry(AffineTransform3dBase X,
                              TransformableGeometry topObject,
                              int flags)
Description copied from interface: TransformableGeometry
Applies an affine transformation to the geometry of this object. If recursively invoked within a component hierarchy, then 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.

Specified by:
transformGeometry in interface TransformableGeometry
Parameters:
X - affine transformation
topObject - component on which the method was initially invoked
flags - provides information about the context in which the transformation is being applied.

skipAuxState

public void skipAuxState(DataBuffer data)
Skips over the state information for this component contained in the supplied data buffer, starting at the current buffer offsets. Essentially this a dummy read; the buffer offsets should be advanced over the state information, but that information should not actually be stored in the component.

Specified by:
skipAuxState in interface HasAuxState
Overrides:
skipAuxState in class ConstrainerBase
Parameters:
data - buffer containing the state information

getAuxState

public void getAuxState(DataBuffer data)
Description copied from interface: HasAuxState
Saves state information for this component by adding data to the supplied DataBuffer. Existing data in the buffer should not be disturbed.

Specified by:
getAuxState in interface HasAuxState
Overrides:
getAuxState in class ConstrainerBase
Parameters:
data - buffer for storing the state values.

getInitialAuxState

public void getInitialAuxState(DataBuffer newData,
                               DataBuffer oldData)
Description copied from interface: HasAuxState
Saves initial state information data for this component by adding data to the supplied data buffer. Existing data in the buffer should not be disturbed.

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.

Specified by:
getInitialAuxState in interface HasAuxState
Overrides:
getInitialAuxState in class ConstrainerBase
Parameters:
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.

setAuxState

public void setAuxState(DataBuffer data)
Description copied from interface: HasAuxState
Restores the state for this component by reading from the supplied data buffer, starting at the current buffer offsets.

Specified by:
setAuxState in interface HasAuxState
Overrides:
setAuxState in class ConstrainerBase
Parameters:
data - buffer containing the state information