Class MeshFacetImpl
java.lang.Object
cz.fidentis.analyst.data.mesh.impl.facet.MeshFacetImpl
- All Implemented Interfaces:
MeshFacet
,Serializable
,Iterable<MeshTriangle>
- Direct Known Subclasses:
MeshRectangleFacetImpl
,PointCloudFacetImpl
Mash facet is a compact triangular mesh without duplicated vertices.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates and empty meshMeshFacetImpl
(MeshFacet facet) Copy constructor of MeshFacetMeshFacetImpl
(Collection<MeshPoint> meshPoints) Creates a point cloud without mesh topology. -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(MeshVisitor visitor) Visits this facet.void
adds vertex to MeshFacetvoid
REPLACE WITH BETTER IMPLEMENTATIONList
<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.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 MeshFacetReturns 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.iterator()
boolean
simplify()
Removes duplicate vertices that differ only in normal vectors or texture coordinates.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
MeshFacetImpl
public MeshFacetImpl()Creates and empty mesh -
MeshFacetImpl
Creates a point cloud without mesh topology.- Parameters:
meshPoints
- Mesh points
-
MeshFacetImpl
Copy constructor of MeshFacet- Parameters:
facet
- copied MeshFacet
-
-
Method Details
-
accept
Description copied from interface:MeshFacet
Visits this facet. -
getVertex
Description copied from interface:MeshFacet
returns vertex of specified index -
addVertex
Description copied from interface:MeshFacet
adds vertex to MeshFacet -
getNumberOfVertices
public int getNumberOfVertices()Description copied from interface:MeshFacet
returns number of vertices in MeshFacet- Specified by:
getNumberOfVertices
in interfaceMeshFacet
- Returns:
- number of vertices
-
getVertices
Description copied from interface:MeshFacet
returns list of vertices in MeshFacet- Specified by:
getVertices
in interfaceMeshFacet
- Returns:
- list of vertices
-
getCornerTable
Description copied from interface:MeshFacet
returns Corner Table representing MeshFacet- Specified by:
getCornerTable
in interfaceMeshFacet
- Returns:
- corner table
-
hasVertexNormals
public boolean hasVertexNormals()Description copied from interface:MeshFacet
Returns true if normals of vertices are calculated.- Specified by:
hasVertexNormals
in interfaceMeshFacet
- Returns:
- true if normals of vertices are calculated.
-
calculateVertexNormals
public void calculateVertexNormals()REPLACE WITH BETTER IMPLEMENTATION- Specified by:
calculateVertexNormals
in interfaceMeshFacet
- Throws:
RuntimeException
- if there are duplicate meth points in the mesh facet
-
getNumTriangles
public int getNumTriangles()Description copied from interface:MeshFacet
Returns number of triangles.- Specified by:
getNumTriangles
in interfaceMeshFacet
- Returns:
- number of triangles
-
getTriangles
Description copied from interface:MeshFacet
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.- Specified by:
getTriangles
in interfaceMeshFacet
- Returns:
- triangles of the mesh facet
-
getAdjacentTriangles
Description copied from interface:MeshFacet
Returns triangles sharing the given mesh vertex.- Specified by:
getAdjacentTriangles
in interfaceMeshFacet
- Parameters:
vertexIndex
- Index of the mesh vertex- Returns:
- Triangles sharing the mesh vertex
-
getAdjacentTriangles
Description copied from interface:MeshFacet
Returns triangles sharing the given edge.- Specified by:
getAdjacentTriangles
in interfaceMeshFacet
- Parameters:
index1
- Index of the first point of the edgeindex2
- Index of the second point of the edge- Returns:
- Triangles sharing the edge
-
getAdjacentTriangles
Description copied from interface:MeshFacet
Returns adjacent triangles, i.e., triangles sharing an edge or a vertex with the given triangle- Specified by:
getAdjacentTriangles
in interfaceMeshFacet
- Parameters:
tri
- The triangle- Returns:
- Unique adjacent triangles
-
getNeighboringTriangles
Description copied from interface:MeshFacet
Returns neighboring triangles, i.e., triangles sharing an edge with the given triangle. In contrast to theMeshFacet.getAdjacentTriangles(MeshTriangle)
, triangles sharing only a vertex are omitted.- Specified by:
getNeighboringTriangles
in interfaceMeshFacet
- Parameters:
tri
- The triangle- Returns:
- Unique neighboring triangles
-
getClosestAdjacentPoint
public javax.vecmath.Point3d getClosestAdjacentPoint(javax.vecmath.Point3d point, int vertexIndex) Description copied from interface:MeshFacet
Finds and returns a point lying at triangles around (sharing) the given mesh vertex and being the closest to a 3D point.- Specified by:
getClosestAdjacentPoint
in interfaceMeshFacet
- 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
public double curvatureDistance(javax.vecmath.Point3d point, int vertexIndex) Description copied from interface:MeshFacet
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 theMeshFacet.getClosestAdjacentPoint(javax.vecmath.Point3d, int)
method.- Specified by:
curvatureDistance
in interfaceMeshFacet
- Parameters:
point
- 3D pointvertexIndex
- Index of mesh vertex- Returns:
- Distance
-
iterator
- Specified by:
iterator
in interfaceIterable<MeshTriangle>
-
calculateVoronoiPoints
Description copied from interface:MeshFacet
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.- Specified by:
calculateVoronoiPoints
in interfaceMeshFacet
- Returns:
- Voronoi points of all triangles.
-
getOneRingNeighborhood
Description copied from interface:MeshFacet
Returns 1-ring neighborhood, i.e., triangles around the given mesh point.- Specified by:
getOneRingNeighborhood
in interfaceMeshFacet
- Parameters:
vertexIndex
- Index of mesh vertex- Returns:
- Triangles around the vertex or
null
-
simplify
public boolean simplify()Description copied from interface:MeshFacet
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.
-