Package cz.fidentis.analyst.data.mesh
Interface MeshFacet
- All Superinterfaces:
Iterable<MeshTriangle>
,Serializable
- All Known Implementing Classes:
MeshFacetImpl
,MeshRectangleFacetImpl
,PointCloudFacetImpl
An encapsulated mesh plate, i.e., multiple triangles sharing vertices.
Mesh facet is iterable (triangle as returned) and visitable by
MeshVisitor
s.-
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(MeshVisitor visitor) Visits this facet.void
adds vertex to MeshFacetvoid
Calculates normals of vertices from normals of triangles.List
<javax.vecmath.Point3d> Computes centers of circumcircle of all triangles.double
curvatureDistance
(javax.vecmath.Point3d point, int vertexIndex) Returns the distance between a 3D point and triangles around (sharing) the given mesh vertex.getAdjacentTriangles
(int vertexIndex) Returns triangles sharing the given mesh vertex.getAdjacentTriangles
(int index1, int index2) Returns triangles sharing the given edge.getAdjacentTriangles
(MeshTriangle triangle) Returns adjacent triangles, i.e., triangles sharing an edge or a vertex with the given trianglejavax.vecmath.Point3d
getClosestAdjacentPoint
(javax.vecmath.Point3d point, int vertexIndex) Finds and returns a point lying at triangles around (sharing) the given mesh vertex and being the closest to a 3D point.returns Corner Table representing MeshFacetgetNeighboringTriangles
(MeshTriangle triangle) Returns neighboring triangles, i.e., triangles sharing an edge with the given triangle.int
returns number of vertices in MeshFacetint
Returns number of triangles.getOneRingNeighborhood
(int vertexIndex) Returns 1-ring neighborhood, i.e., triangles around the given mesh point.Return triangle instances.getVertex
(int index) returns vertex of specified indexreturns list of vertices in MeshFacetboolean
Returns true if normals of vertices are calculated.boolean
simplify()
Removes duplicate vertices that differ only in normal vectors or texture coordinates.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
getVertex
returns vertex of specified index- Parameters:
index
- index of vertex- Returns:
- vertex
-
addVertex
adds vertex to MeshFacet- Parameters:
point
- new vertex
-
getNumberOfVertices
int getNumberOfVertices()returns number of vertices in MeshFacet- Returns:
- number of vertices
-
getVertices
returns list of vertices in MeshFacet- Returns:
- list of vertices
-
getCornerTable
CornerTable getCornerTable()returns Corner Table representing MeshFacet- Returns:
- corner table
-
hasVertexNormals
boolean hasVertexNormals()Returns true if normals of vertices are calculated.- Returns:
- true if normals of vertices are calculated.
-
calculateVertexNormals
void calculateVertexNormals()Calculates normals of vertices from normals of triangles. -
getNumTriangles
int getNumTriangles()Returns number of triangles.- Returns:
- number of triangles
-
getTriangles
List<MeshTriangle> getTriangles()Return triangle instances. The order corresponds with the corner table, i.e., the i-th returned triangle corresponds to i-th triangle in the corner table.- Returns:
- triangles of the mesh facet
-
getAdjacentTriangles
Returns triangles sharing the given mesh vertex.- Parameters:
vertexIndex
- Index of the mesh vertex- Returns:
- Triangles sharing the mesh vertex
-
getAdjacentTriangles
Returns triangles sharing the given edge.- Parameters:
index1
- Index of the first point of the edgeindex2
- Index of the second point of the edge- Returns:
- Triangles sharing the edge
-
getAdjacentTriangles
Returns adjacent triangles, i.e., triangles sharing an edge or a vertex with the given triangle- Parameters:
triangle
- The triangle- Returns:
- Unique adjacent triangles
-
getNeighboringTriangles
Returns neighboring triangles, i.e., triangles sharing an edge with the given triangle. In contrast to thegetAdjacentTriangles(MeshTriangle)
, triangles sharing only a vertex are omitted.- Parameters:
triangle
- The triangle- Returns:
- Unique neighboring triangles
-
getClosestAdjacentPoint
javax.vecmath.Point3d getClosestAdjacentPoint(javax.vecmath.Point3d point, int vertexIndex) Finds and returns a point lying at triangles around (sharing) the given mesh vertex and being the closest to a 3D point.- Parameters:
point
- 3D pointvertexIndex
- Index of mesh vertex- Returns:
- The closest surface point near the mesh vertex being closest to the given 3D point
-
curvatureDistance
double curvatureDistance(javax.vecmath.Point3d point, int vertexIndex) Returns the distance between a 3D point and triangles around (sharing) the given mesh vertex. It is the distance between the 3D point and point found by thegetClosestAdjacentPoint(javax.vecmath.Point3d, int)
method.- Parameters:
point
- 3D pointvertexIndex
- Index of mesh vertex- Returns:
- Distance
-
accept
Visits this facet.- Parameters:
visitor
- Visitor
-
calculateVoronoiPoints
List<javax.vecmath.Point3d> calculateVoronoiPoints()Computes centers of circumcircle of all triangles. These points represent the point of Voronoi area used for Delaunay triangulation, for instance. The list is computed only once (during the first call) and than cached. The order corresponds to the order of triangles, i.e., the i-th point is the Voronoi point of i-th triangle.- Returns:
- Voronoi points of all triangles.
-
getOneRingNeighborhood
Returns 1-ring neighborhood, i.e., triangles around the given mesh point.- Parameters:
vertexIndex
- Index of mesh vertex- Returns:
- Triangles around the vertex or
null
-
simplify
boolean simplify()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.- Returns:
true
if the mesh was changed,false
if there were no duplicities.
-