Interface MeshFacet

All Superinterfaces:
Iterable<MeshTriangle>, Serializable
All Known Implementing Classes:
MeshFacetImpl, MeshRectangleFacetImpl, PointCloudFacetImpl

public interface MeshFacet extends Iterable<MeshTriangle>, Serializable
An encapsulated mesh plate, i.e., multiple triangles sharing vertices. Mesh facet is iterable (triangle as returned) and visitable by MeshVisitors.
  • Method Details

    • getVertex

      MeshPoint getVertex(int index)
      returns vertex of specified index
      Parameters:
      index - index of vertex
      Returns:
      vertex
    • addVertex

      void addVertex(MeshPoint point)
      adds vertex to MeshFacet
      Parameters:
      point - new vertex
    • getNumberOfVertices

      int getNumberOfVertices()
      returns number of vertices in MeshFacet
      Returns:
      number of vertices
    • getVertices

      List<MeshPoint> 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

      List<MeshTriangle> getAdjacentTriangles(int vertexIndex)
      Returns triangles sharing the given mesh vertex.
      Parameters:
      vertexIndex - Index of the mesh vertex
      Returns:
      Triangles sharing the mesh vertex
    • getAdjacentTriangles

      List<MeshTriangle> getAdjacentTriangles(int index1, int index2)
      Returns triangles sharing the given edge.
      Parameters:
      index1 - Index of the first point of the edge
      index2 - Index of the second point of the edge
      Returns:
      Triangles sharing the edge
    • getAdjacentTriangles

      List<MeshTriangle> getAdjacentTriangles(MeshTriangle triangle)
      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

      List<MeshTriangle> getNeighboringTriangles(MeshTriangle triangle)
      Returns neighboring triangles, i.e., triangles sharing an edge with the given triangle. In contrast to the getAdjacentTriangles(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 point
      vertexIndex - 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 the getClosestAdjacentPoint(javax.vecmath.Point3d, int) method.
      Parameters:
      point - 3D point
      vertexIndex - Index of mesh vertex
      Returns:
      Distance
    • accept

      void accept(MeshVisitor visitor)
      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

      TriangleFan getOneRingNeighborhood(int vertexIndex)
      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.