Class PbMesh
PbMesh2D
) or a volume mesh (see PbMesh3D
). A surface mesh can be either 2D (its nodes have 2 coordinates) or 3D (its nodes have 3 coordinates). Each node is referred to by an index named node_index.
A mesh is composed of a list of cells. A cell is a "simple" basic volume or surface element that connects adjacent nodes of the mesh. Surface meshes can be defined by triangles, quadrangles and polygonal cells. Volume meshes can be defined by tetrahedrons, hexahedrons, prisms, or pyramid cells. A cell is defined by the list of nodes (node indices) that it connects. The order of the nodes that define a cell is the same for each cell in the mesh. Each cell is referred to by an index named cell_index.
A list of value-set can be defined. A value is a scalar (float), string, or a vector. Each value is located on mesh node, so the number of values in a set must be equal to the number of mesh's nodes. Each set of values can be named by a string.
A scalar value set is used to color the representations of the mesh. A string value set is used by some charting representations. A vector value set is used to make "hedgehog" vector field representations, or streamline representations. Each data-set is referred by an index named set_index. This index is used by classes of mesh representation to indicate which value set must be used for coloring. (see PoMesh.valuesIndex
and PoMesh.vecsIndex
). Mapping a scalar value onto a color is done by PbDataMapping
or PoDataMapping
classes (and derived).
Data duplication:
If the last argument is_data_duplicate of a constructor of a derived class is false, the geometry and values sets are not copied by the object.
In this case, the methods setGeometry, addValuesSet, addStringsSet and addVecsSet save only the adress of the user data set and it is the application's responsibility to manage the validity of data during the existence of the mesh object.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
static class
static enum
Data binding.Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
Field Summary
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addStringsSet
(int set_index, String[] val) Calls addStringsSet(set_index, val, "").void
addStringsSet
(int set_index, String[] val, String set_name) Adds a set of string values .void
addValuesSet
(int set_index, float[] val) Calls addValuesSet(set_index, val, "").void
addValuesSet
(int set_index, float[] val, PbMesh.DataBindings binding) Calls addValuesSet(set_index, val, binding, "").void
addValuesSet
(int set_index, float[] val, PbMesh.DataBindings binding, String set_name) Adds a set of scalar values that can be located either at nodes or at cells.void
addValuesSet
(int set_index, float[] val, String set_name) Adds a set of scalar values.void
addVecsSet
(int set_index, SbVec3f[] val) Calls addVecsSet(set_index, val, "").void
addVecsSet
(int set_index, SbVec3f[] val, String set_name) Adds a set of vector values .findContainingCell
(SbVec3f point, float tolerance) Find the cell that contains the point.findContainingCell
(SbVec3f point, float tolerance, PbCell adjacent_cell) float
getArea()
Gets the area of the mesh.Gets the biggest cell's bounding box, returns also the index of this cell .Gets the bounding box of the mesh.getCell
(int cell_index) Gets the cell with index cell_index.Get the current coordinates of the nodes of this mesh.getDirectValuesSet
(int set_index) Gets a set of scalar values.getDirectVecsSet
(int set_index) Gets a set of vector values.float
getMaxValuesSet
(int set_index) Gets the max of a set of scalars.float
getMaxVecsSet
(int set_index) Gets the max module of a set of vectors.float
getMinValuesSet
(int set_index) Gets the min of a set of scalars.float
getMinVecsSet
(int set_index) Gets the min module of a set of vectors.getNodeCoord
(int nod_index) Gets the coordinates of a node.int
Gets the number of cells in the mesh.int
Gets the number of nodes in the mesh.int
Gets the number of set of string values.int
Gets the number of set of scalar values.int
Gets the number of set of vector values.Gets the smallest cell's bounding box, returns also the index of this cell .getStringsSetName
(int set_index) Gets the name associated to a string values set.getValuesBinding
(int set_index) Gets the binding of the scalar value set.float[]
getValuesSet
(int set_index) Gets a set of scalar values.getValuesSetName
(int set_index) Gets the name associated to a scalar values set.SbVec3f[]
getVecsSet
(int set_index) Gets a set of vector values.getVecsSetName
(int set_index) Gets the name associated to a vec values set.float
Gets the volume of the mesh.boolean
Returns true if mesh's data are duplicated, false otherwise.void
Remove all sets of strings values.void
Remove all sets of scalar values.void
Remove all sets of vector values.boolean
removeStringsSet
(int set_index) Remove a set of string values.boolean
removeValuesSet
(int set_index) Remove a set of scalar values.boolean
removeVecsSet
(int set_index) Remove a set of vector values.void
setCoordinates
(float[] x_nod, float[] y_nod, float[] z_nod) Set new node coordinates without modifying the mesh topology.Methods inherited from class com.openinventor.meshviz.graph.PbBase
enableConnection, isConnectionEnabled, touch
Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
Method Details
-
addValuesSet
public void addValuesSet(int set_index, float[] val) Calls addValuesSet(set_index, val, ""). -
addValuesSet
Calls addValuesSet(set_index, val, binding, ""). -
addStringsSet
Calls addStringsSet(set_index, val, ""). -
addVecsSet
Calls addVecsSet(set_index, val, ""). -
getStringsSetName
Gets the name associated to a string values set. NULL is returned if the set does not exist. -
getVecsSetName
Gets the name associated to a vec values set. NULL is returned if the set does not exist. -
addVecsSet
Adds a set of vector values . The number of values in a set must be equal to the number of nodes in the mesh. The set can be optionally named (set_name parameter). -
getValuesSetName
Gets the name associated to a scalar values set. NULL is returned if the set does not exist. -
getDirectValuesSet
Gets a set of scalar values. -
getVecsSet
Gets a set of vector values. -
removeValuesSet
public boolean removeValuesSet(int set_index) Remove a set of scalar values.- Returns:
- false if the scalar set does not exist,
-
getDirectVecsSet
Gets a set of vector values. -
getValuesSet
public float[] getValuesSet(int set_index) Gets a set of scalar values. -
getNodeCoord
Gets the coordinates of a node. -
getBoundingBox
Gets the bounding box of the mesh. -
getNumCells
public int getNumCells()Gets the number of cells in the mesh. -
getMinValuesSet
public float getMinValuesSet(int set_index) Gets the min of a set of scalars.- Returns:
- false if the scalar set does not exist,
-
getNumNodes
public int getNumNodes()Gets the number of nodes in the mesh. -
getValuesBinding
Gets the binding of the scalar value set.- Parameters:
set_index
- the index of the set of scalar values.- Returns:
- PER_CELL or PER_NODE, or undefined binding if specified data set does not exist.
-
addStringsSet
Adds a set of string values . The number of string in a set must be equal to the number of nodes in the mesh. The set can be optionally named (set_name parameter). -
addValuesSet
Adds a set of scalar values that can be located either at nodes or at cells. Warning: At this time, the PER_CELL data binding is taken into account only by the following classes:PoMeshLevelSurf
(just for coloring, the level surface of value per cell is not taken into account)PoMeshSkin
PoMeshCrossSection
The other classes use inherited coloring mode when the PER_CELL binding is used.
- Parameters:
set_index
- the index of the new set added.val
- the array of values. Its size must be either the number of nodes or the number of cells depending on the binding argument.binding
- specifies the location of the values.set_name
- string associated with this set of values. NOTE: This method must be called after a setGeometry method because the size of the argument val is determined by the number of nodes in the mesh. The setGeometry methods are defined in subclasses ofPbMesh
.
-
isDataDuplicated
public boolean isDataDuplicated()Returns true if mesh's data are duplicated, false otherwise. If the data are not duplicated, the method addValuesSet, addStringsSet, addVecsSet save only the adress of the user data set. In this case, it user's responsibility to check the validity of data during the existence of thePbMesh
object. -
addValuesSet
Adds a set of scalar values. The values are located at nodes so the number of values in a set must be equal to the number of nodes in the mesh.- Parameters:
set_index
- the index of the new set added.val
- the array of values. Its size must be the number of nodes.set_name
- string associated with this set of values. NOTE: This method must be called after a setGeometry method because the size of the argument val is determined by the number of nodes in the mesh. The setGeometry methods are defined in subclasses ofPbMesh
.
-
removeStringsSet
public boolean removeStringsSet(int set_index) Remove a set of string values.- Returns:
- false if the scalar set does not exist,
-
getMaxValuesSet
public float getMaxValuesSet(int set_index) Gets the max of a set of scalars.- Returns:
- false if the scalar set does not exist,
-
getBiggestCellBox
Gets the biggest cell's bounding box, returns also the index of this cell . -
getVolume
public float getVolume()Gets the volume of the mesh. Returns always 0 for a surface mesh -
getArea
public float getArea()Gets the area of the mesh. Returns always 0 for a volume mesh -
getMinVecsSet
public float getMinVecsSet(int set_index) Gets the min module of a set of vectors.- Returns:
- false if the vector set does not exist,
-
getMaxVecsSet
public float getMaxVecsSet(int set_index) Gets the max module of a set of vectors.- Returns:
- false if the vector set does not exist,
-
getCell
Gets the cell with index cell_index. Returns NULL if the cell does not exist. Attention! this method returns always the same adress of an internal private cell. This private cell is updated each time getCell is called. -
getSmallestCellBox
Gets the smallest cell's bounding box, returns also the index of this cell . -
removeAllVecsSet
public void removeAllVecsSet()Remove all sets of vector values. -
getCoordinates
Get the current coordinates of the nodes of this mesh.- Parameters:
xnod
- array of x coordynod
- array of y coordznod
- array of z coordsize_xnod
- size of the array xnodsize_ynod
- size of the array ynodsize_znod
- size of the array znod
-
removeAllStringsSet
public void removeAllStringsSet()Remove all sets of strings values. -
removeVecsSet
public boolean removeVecsSet(int set_index) Remove a set of vector values.- Returns:
- false if the vector set does not exist,
-
removeAllValuesSet
public void removeAllValuesSet()Remove all sets of scalar values. -
getNumValuesSet
public int getNumValuesSet()Gets the number of set of scalar values. -
getNumVecsSet
public int getNumVecsSet()Gets the number of set of vector values. -
findContainingCell
public PbMesh.ContainingCell findContainingCell(SbVec3f point, float tolerance, PbCell adjacent_cell) -
findContainingCell
Find the cell that contains the point. If the (optional) adjacent cell is given, searching the containing cell starts by the cells around this adjacent one. Returns also the parametric coordinates of the point in the found cell. Parametric coordinates are the coordinates of the point relative to a topological equivalent unit cell. A point is inside a cell if its parametric coordinates range from 0 to 1. However we use a test with a tolerance value : a point is inside the cell if its parametric coordinates p verify -tolerance <= p <= 1+tolerance. Parametric coordinates are useful to interpolate the value in the cell (seePbCell.getValue
). Attention! This method returns always the same address of an internal private cell. This private cell is updated each time findContainingCell is called. -
setCoordinates
public void setCoordinates(float[] x_nod, float[] y_nod, float[] z_nod) Set new node coordinates without modifying the mesh topology. For performance reasons, this method should be called instead of setGeometry when doing a mesh deformation animation. -
getNumStringsSet
public int getNumStringsSet()Gets the number of set of string values.
-