public class ScalarGridField extends GridFieldBase implements ScalarFieldComponent
ScalarGrid
component.| Modifier and Type | Class and Description |
|---|---|
static class |
ScalarGridField.Visualization |
ModelComponent.FilePathSaveType, ModelComponent.NavpanelVisibility| Modifier and Type | Field and Description |
|---|---|
static Renderer.ColorInterpolation |
DEFAULT_COLOR_INTERPOLATION |
static ScalarGridField.Visualization |
DEFAULT_VISUALIZATION |
static PropertyList |
myProps |
static double |
OUTSIDE_GRID
Special value indicating that a query point is outside the grid.
|
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNamesTG_ARTICULATED, TG_DRAGGER, TG_PRESERVE_ORIENTATION, TG_SIMULATINGTRANSPARENT, TWO_DIMENSIONAL| Constructor and Description |
|---|
ScalarGridField()
This constructor should not be called by applications, unless
ModelComponentBase.scan(maspack.util.ReaderTokenizer, java.lang.Object) is called immediately after. |
ScalarGridField(ScalarGrid grid)
Constructs a field using a given grid.
|
ScalarGridField(java.lang.String name,
ScalarGrid grid)
Constructs a named field using a given grid.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addRenderMeshComp(FixedMeshBody mcomp) |
void |
clearRenderMeshComps() |
RenderProps |
createRenderProps()
Factory method to create render properties appropriate to this object.
|
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
Renderer.ColorInterpolation |
getColorInterpolation() |
ColorMapBase |
getColorMap() |
ScalarGrid |
getGrid() |
FixedMeshBody |
getRenderMeshComp(int idx) |
ScalarRange |
getRenderRange() |
boolean |
getRenderSurface()
Queries whether or not iso-surface rendering is enabled for this grid.
|
void |
getSelection(java.util.LinkedList<java.lang.Object> list,
int qid)
Append to
list the component (or components) associated with
the qid-th selection query issued by this component's render
method. |
void |
getSoftReferences(java.util.List<ModelComponent> refs)
Appends all soft references for this component to a list.
|
PolygonalMesh |
getSurface() |
double |
getSurfaceDistance()
Returns the distance value used for creating this grid's iso-surface.
|
double |
getValue(FemFieldPoint fp)
Returns the value of the this field at a specified FEM field point.
|
double |
getValue(MeshFieldPoint fp)
Returns the value of the this field at a specified mesh field point.
|
double |
getValue(Point3d pos)
Queries the field value associated with this grid at a specified
position.
|
DoubleInterval |
getValueRange()
Returns the range of all values in this field, including
the default value.
|
Point3d |
getVertexPosition(int vi)
Gets the position of the vertex indexed by
vi. |
Point3d |
getVertexPosition(int xi,
int yj,
int zk)
Gets the position of the vertex indexed by its indices along the x, y,
and z axes.
|
double |
getVertexValue(int vi)
Returns the value at the grid vertex indexed by
vi. |
double |
getVertexValue(int xi,
int yj,
int zk)
Returns the value at the grid vertex indexed by its indices along the x,
y, and z axes.
|
ScalarGridField.Visualization |
getVisualization() |
Range |
getVisualizationRange() |
int |
numRenderMeshComps() |
int |
numSelectionQueriesNeeded()
If this selectable manages its own selection (by issuing selection
queries within its
render method), then this method should
return the maximum number of selection queries that will be
required. |
int |
numVertices()
Returns the number of vertices in the grid.
|
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 |
removeRenderMeshComp(FixedMeshBody mcomp) |
void |
render(Renderer renderer,
int flags)
Render this object using the functionality of the supplied
Renderer. |
void |
setColorInterpolation(Renderer.ColorInterpolation interp) |
void |
setColorMap(ColorMapBase map) |
void |
setGrid(ScalarGrid grid)
Sets the grid for this ScalarGridField.
|
void |
setLocalToWorld(RigidTransform3d TGW) |
void |
setRenderRange(ScalarRange range) |
void |
setRenderSurface(boolean enable)
Sets whether or not iso-surface rendering is enabled for this grid.
|
void |
setSurfaceDistance(double dist)
Sets the distance value used for creating this grid's iso-surface.
|
void |
setVertexValue(int vi,
double value)
Sets the value at the grid vertex indexed by
vi, which is
computed from the axial vertex indices xi, yj, zk
according to |
void |
setVertexValue(int xi,
int yj,
int zk,
double value)
Sets the value at the grid vertex indexed by its indices along the x,
y, and z axes.
|
void |
setVisualization(ScalarGridField.Visualization vis) |
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.
|
getClipToGrid, getUseFemRestPositions, getUseLocalValuesForField, setClipToGrid, setUseFemRestPositions, setUseLocalValuesForFieldaddTransformableDependencies, clearCacheIfNecessary, defaultRenderProps, getLocalToWorld, getLocalToWorld, getRenderGrid, getRenderRanges, getRenderRangesRange, getRenderVertices, scaleDistance, scaleMass, setGrid, setRenderGrid, setRenderRanges, setRenderVertices, transformGeometry, transformGeometry, updateBoundscopy, defaultRenderPropsAreNull, getRenderHints, getRenderProps, isSelectable, isVisible, setRenderProps, setVisible, updateRenderPropscheckFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getChildren, getGrandParent, getHardReferences, 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, writeequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclearCacheIfNecessaryconnectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, setWritablegetPropertygetChildren, hasChildrenpostscanisWritable, writetransformPrioritypublic static final Renderer.ColorInterpolation DEFAULT_COLOR_INTERPOLATION
public static ScalarGridField.Visualization DEFAULT_VISUALIZATION
public static double OUTSIDE_GRID
public static PropertyList myProps
public ScalarGridField()
ModelComponentBase.scan(maspack.util.ReaderTokenizer, java.lang.Object) is called immediately after.public ScalarGridField(ScalarGrid grid)
grid - scalar grid used to implement the field.public ScalarGridField(java.lang.String name,
ScalarGrid grid)
grid - name name of the fieldgrid - scalar grid used to implement the fieldpublic PropertyList getAllPropertyInfo()
HasPropertiesgetAllPropertyInfo in interface HasPropertiesgetAllPropertyInfo in class GridFieldBasepublic int numVertices()
public ScalarGridField.Visualization getVisualization()
public void setVisualization(ScalarGridField.Visualization vis)
public Range getVisualizationRange()
public Renderer.ColorInterpolation getColorInterpolation()
public void setColorInterpolation(Renderer.ColorInterpolation interp)
public ColorMapBase getColorMap()
public void setColorMap(ColorMapBase map)
public void setRenderRange(ScalarRange range)
public ScalarRange getRenderRange()
public double getSurfaceDistance()
public void setSurfaceDistance(double dist)
dist - iso-surface distance valuepublic boolean getRenderSurface()
true if iso-surface rendering is enabledpublic void setRenderSurface(boolean enable)
enable - if true, enables iso-surface renderingpublic void addRenderMeshComp(FixedMeshBody mcomp)
public boolean removeRenderMeshComp(FixedMeshBody mcomp)
public FixedMeshBody getRenderMeshComp(int idx)
public int numRenderMeshComps()
public void clearRenderMeshComps()
public void setLocalToWorld(RigidTransform3d TGW)
setLocalToWorld in class GridCompBasepublic double getValue(Point3d pos)
getUseLocalValuesForField returns true.
If the query point is outside the grid, then the value for the nearest
grid point is returned if the property cliptoGrid is true; otherwise the special value OUTSIDE_GRID is returned.
getValue in interface ScalarFieldComponentpos - query positionpublic Point3d getVertexPosition(int xi, int yj, int zk)
true.xi - x vertex indexyj - y vertex indexzk - z vertex indexpublic Point3d getVertexPosition(int vi)
vi. See setVertexValue(int,double) for a description of how vi is
computed. The position is in either local or world coordinates depending
on whether GridFieldBase.getUseLocalValuesForField() returns true.vi - vertex indexpublic double getValue(FemFieldPoint fp)
ScalarFieldComponentgetValue in interface ScalarFieldComponentfp - point at which value is requestedpublic double getValue(MeshFieldPoint fp)
ScalarFieldComponentgetValue in interface ScalarFieldComponentfp - point at which value is requestedpublic ScalarGrid getGrid()
getGrid in class GridCompBasepublic double getVertexValue(int vi)
vi. See setVertexValue(int,double) for a description of how vi is
computed.vi - index of the vertexpublic void setVertexValue(int xi,
int yj,
int zk,
double value)
xi - x vertex indexyj - y vertex indexzk - z vertex indexvalue - new vertex valuepublic void setVertexValue(int vi,
double value)
vi, which is
computed from the axial vertex indices xi, yj, zk
according to
vi = xi + nx*yj + (nx*ny)*zkwhere
nx and ny are the number
of vertices along x and y axes.vi - index of the vertexvalue - new vertex valuepublic double getVertexValue(int xi,
int yj,
int zk)
xi - x vertex indexyj - y vertex indexzk - z vertex indexpublic void setGrid(ScalarGrid grid)
renderRanges and localToWorld transform are updated from the current renderRanges
and gridtoWorld transform values for this component.grid - grid to setpublic PolygonalMesh getSurface()
public RenderProps createRenderProps()
HasRenderPropscreateRenderProps in interface HasRenderPropscreateRenderProps in class GridCompBasepublic DoubleInterval getValueRange()
public void prerender(RenderList list)
IsRenderablelist.addIfVisible (obj);
for each of the objects in question.prerender in interface IsRenderableprerender in class GridCompBaselist - list of objects to be renderedpublic void render(Renderer renderer, int flags)
IsRenderableRenderer.render in interface IsRenderablerender in class GridCompBaserenderer - 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 int numSelectionQueriesNeeded()
IsSelectablerender method), then this method should
return the maximum number of selection queries that will be
required. Otherwise, this method should return -1.numSelectionQueriesNeeded in interface IsSelectablenumSelectionQueriesNeeded in class RenderableComponentBasepublic void getSelection(java.util.LinkedList<java.lang.Object> list,
int qid)
IsSelectablelist the component (or components) associated with
the qid-th selection query issued by this component's render
method. This will only be called if this component manages its own
selection (i.e., the number nums returned by IsSelectable.numSelectionQueriesNeeded() is positive), and qid will in
turn be a number between 0 and nums-1.getSelection in interface IsSelectablegetSelection in class RenderableComponentBaselist - selected objects are appended to the end of this listqid - index of the selection querypublic void getSoftReferences(java.util.List<ModelComponent> refs)
updateReferences() 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 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.