public class ScalarGridField extends GridFieldBase implements ScalarFieldComponent
ScalarGrid
component.Modifier and Type | Class and Description |
---|---|
static class |
ScalarGridField.Visualization |
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, useCompactPathNames
TG_ARTICULATED, TG_DRAGGER, TG_PRESERVE_ORIENTATION, TG_SIMULATING
TRANSPARENT, 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, setUseLocalValuesForField
addTransformableDependencies, clearCacheIfNecessary, defaultRenderProps, getLocalToWorld, getLocalToWorld, getRenderGrid, getRenderRanges, getRenderRangesRange, getRenderVertices, scaleDistance, scaleMass, setGrid, setRenderGrid, setRenderRanges, setRenderVertices, transformGeometry, transformGeometry, updateBounds
copy, defaultRenderPropsAreNull, getRenderHints, getRenderProps, isSelectable, isVisible, setRenderProps, setVisible, updateRenderProps
checkFlag, 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, write
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clearCacheIfNecessary
connectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, setWritable
getProperty
getChildren, hasChildren
postscan
isWritable, write
transformPriority
public 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()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class GridFieldBase
public 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 GridCompBase
public 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 ScalarFieldComponent
pos
- 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)
ScalarFieldComponent
getValue
in interface ScalarFieldComponent
fp
- point at which value is requestedpublic double getValue(MeshFieldPoint fp)
ScalarFieldComponent
getValue
in interface ScalarFieldComponent
fp
- point at which value is requestedpublic ScalarGrid getGrid()
getGrid
in class GridCompBase
public 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()
HasRenderProps
createRenderProps
in interface HasRenderProps
createRenderProps
in class GridCompBase
public DoubleInterval getValueRange()
public void prerender(RenderList list)
IsRenderable
list.addIfVisible (obj);
for each of the objects in question.prerender
in interface IsRenderable
prerender
in class GridCompBase
list
- list of objects to be renderedpublic void render(Renderer renderer, int flags)
IsRenderable
Renderer
.render
in interface IsRenderable
render
in class GridCompBase
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 int numSelectionQueriesNeeded()
IsSelectable
render
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 IsSelectable
numSelectionQueriesNeeded
in class RenderableComponentBase
public void getSelection(java.util.LinkedList<java.lang.Object> list, int qid)
IsSelectable
list
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 IsSelectable
getSelection
in class RenderableComponentBase
list
- 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 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.