Package cz.fidentis.analyst.data.mesh
Interface MeshModel
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
MeshModelImpl
The main object for triangular meshes. Each mesh model consists of one or
more mesh facets.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a new mesh facet to the model.void
addFacets
(Collection<MeshFacet> newFacets) Adds a new mesh facets to the model.void
compute
(MeshVisitor visitor) Applies the visitor to all mesh facets sequentially.void
compute
(MeshVisitor visitor, boolean concurrently) Applies the visitor to all mesh facets.default boolean
Recomputes vertex normals of only mesh faces for which the normals are missing.boolean
estimateVertexNormals
(boolean recomputeAll) Recomputes normals of vertices.javax.vecmath.Point3d
Returns central point computed from mesh verticesreturns list of mesh facetsgets the material of the modellong
Returns number of vertices (sum of all facets).boolean
Returnstrue
if the mesh vertices have set curvature values.boolean
Returnstrue
if at least any vertex normals were automatically estimated.boolean
removeFacet
(int index) Removes facet from the model.void
change facetsvoid
setMaterial
(Material mtl) changes material of the modelvoid
Removes duplicate vertices that differ only in normal vectors or texture coordinates.
-
Method Details
-
setFacets
change facets- Parameters:
facets
- Facets of the mesh model
-
getFacets
returns list of mesh facets- Returns:
- list of mesh facets
-
addFacet
Adds a new mesh facet to the model.- Parameters:
facet
- new mesh facet
-
removeFacet
Removes facet from the model.- Parameters:
index
- Index of the facet- Returns:
- Removed facet or
null
- Throws:
IndexOutOfBoundsException
- if the facet does not exist
-
addFacets
Adds a new mesh facets to the model.- Parameters:
newFacets
- collection of new facets
-
getMaterial
Material getMaterial()gets the material of the model- Returns:
- material
-
setMaterial
changes material of the model- Parameters:
mtl
- Material
-
hasMaterial
boolean hasMaterial()- Returns:
true
if material exists
-
hasCurvature
boolean hasCurvature()Returnstrue
if the mesh vertices have set curvature values.- Returns:
true
if the mesh vertices have set curvature values.
-
compute
Applies the visitor to all mesh facets. If the visitor is thread-safe and theconcurrently
istrue
, then the visitor is applied to all mesh facet concurrently using all CPU cores.- Parameters:
visitor
- Visitor to be applied for the computationconcurrently
- Parallel computation- Throws:
NullPointerException
- if the visitor isnull
-
compute
Applies the visitor to all mesh facets sequentially.- Parameters:
visitor
- Visitor to be applied for the computation- Throws:
NullPointerException
- if the visitor isnull
-
simplifyModel
void simplifyModel()Removes duplicate vertices that differ only in normal vectors or texture coordinates. Multiple normals are replaced with the average normal. If the texture coordinate differ then randomly selected one is used. -
getNumVertices
long getNumVertices()Returns number of vertices (sum of all facets).- Returns:
- Number of vertices
-
getCentroid
javax.vecmath.Point3d getCentroid()Returns central point computed from mesh vertices- Returns:
- centroid
-
hasEstimatedVertNormals
boolean hasEstimatedVertNormals()Returnstrue
if at least any vertex normals were automatically estimated. Returnsfalse
if all vertex normals were predefined in the mesh file- Returns:
true
if at least any vertex normals were automatically estimated.
-
estimateVertexNormals
boolean estimateVertexNormals(boolean recomputeAll) Recomputes normals of vertices.- Parameters:
recomputeAll
- Iftrue
, then all normals are recomputed (estimated). Iffalse
, then only missing vertex normals are recomputed.- Returns:
true
if some normals were recomputed
-
estimateMissingVertexNormals
default boolean estimateMissingVertexNormals()Recomputes vertex normals of only mesh faces for which the normals are missing.- Returns:
true
if (some) normals were recomputed
-