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

public class MeshFacetImpl extends Object implements MeshFacet
Mash facet is a compact triangular mesh without duplicated vertices.
See Also:
  • Constructor Details

    • MeshFacetImpl

      public MeshFacetImpl()
      Creates and empty mesh
    • MeshFacetImpl

      public MeshFacetImpl(Collection<MeshPoint> meshPoints)
      Creates a point cloud without mesh topology.
      Parameters:
      meshPoints - Mesh points
    • MeshFacetImpl

      public MeshFacetImpl(MeshFacet facet)
      Copy constructor of MeshFacet
      Parameters:
      facet - copied MeshFacet
  • Method Details

    • accept

      public void accept(MeshVisitor visitor)
      Description copied from interface: MeshFacet
      Visits this facet.
      Specified by:
      accept in interface MeshFacet
      Parameters:
      visitor - Visitor
    • getVertex

      public MeshPoint getVertex(int index)
      Description copied from interface: MeshFacet
      returns vertex of specified index
      Specified by:
      getVertex in interface MeshFacet
      Parameters:
      index - index of vertex
      Returns:
      vertex
    • addVertex

      public void addVertex(MeshPoint point)
      Description copied from interface: MeshFacet
      adds vertex to MeshFacet
      Specified by:
      addVertex in interface MeshFacet
      Parameters:
      point - new vertex
    • getNumberOfVertices

      public int getNumberOfVertices()
      Description copied from interface: MeshFacet
      returns number of vertices in MeshFacet
      Specified by:
      getNumberOfVertices in interface MeshFacet
      Returns:
      number of vertices
    • getVertices

      public List<MeshPoint> getVertices()
      Description copied from interface: MeshFacet
      returns list of vertices in MeshFacet
      Specified by:
      getVertices in interface MeshFacet
      Returns:
      list of vertices
    • getCornerTable

      public CornerTable getCornerTable()
      Description copied from interface: MeshFacet
      returns Corner Table representing MeshFacet
      Specified by:
      getCornerTable in interface MeshFacet
      Returns:
      corner table
    • hasVertexNormals

      public boolean hasVertexNormals()
      Description copied from interface: MeshFacet
      Returns true if normals of vertices are calculated.
      Specified by:
      hasVertexNormals in interface MeshFacet
      Returns:
      true if normals of vertices are calculated.
    • calculateVertexNormals

      public void calculateVertexNormals()
      REPLACE WITH BETTER IMPLEMENTATION
      Specified by:
      calculateVertexNormals in interface MeshFacet
      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 interface MeshFacet
      Returns:
      number of triangles
    • getTriangles

      public List<MeshTriangle> 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 interface MeshFacet
      Returns:
      triangles of the mesh facet
    • getAdjacentTriangles

      public List<MeshTriangle> getAdjacentTriangles(int vertexIndex)
      Description copied from interface: MeshFacet
      Returns triangles sharing the given mesh vertex.
      Specified by:
      getAdjacentTriangles in interface MeshFacet
      Parameters:
      vertexIndex - Index of the mesh vertex
      Returns:
      Triangles sharing the mesh vertex
    • getAdjacentTriangles

      public List<MeshTriangle> getAdjacentTriangles(int index1, int index2)
      Description copied from interface: MeshFacet
      Returns triangles sharing the given edge.
      Specified by:
      getAdjacentTriangles in interface MeshFacet
      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

      public List<MeshTriangle> getAdjacentTriangles(MeshTriangle tri)
      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 interface MeshFacet
      Parameters:
      tri - The triangle
      Returns:
      Unique adjacent triangles
    • getNeighboringTriangles

      public List<MeshTriangle> getNeighboringTriangles(MeshTriangle tri)
      Description copied from interface: MeshFacet
      Returns neighboring triangles, i.e., triangles sharing an edge with the given triangle. In contrast to the MeshFacet.getAdjacentTriangles(MeshTriangle), triangles sharing only a vertex are omitted.
      Specified by:
      getNeighboringTriangles in interface MeshFacet
      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 interface MeshFacet
      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

      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 the MeshFacet.getClosestAdjacentPoint(javax.vecmath.Point3d, int) method.
      Specified by:
      curvatureDistance in interface MeshFacet
      Parameters:
      point - 3D point
      vertexIndex - Index of mesh vertex
      Returns:
      Distance
    • iterator

      public Iterator<MeshTriangle> iterator()
      Specified by:
      iterator in interface Iterable<MeshTriangle>
    • calculateVoronoiPoints

      public List<javax.vecmath.Point3d> 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 interface MeshFacet
      Returns:
      Voronoi points of all triangles.
    • getOneRingNeighborhood

      public TriangleFanImpl getOneRingNeighborhood(int vertexIndex)
      Description copied from interface: MeshFacet
      Returns 1-ring neighborhood, i.e., triangles around the given mesh point.
      Specified by:
      getOneRingNeighborhood in interface MeshFacet
      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.
      Specified by:
      simplify in interface MeshFacet
      Returns:
      true if the mesh was changed, false if there were no duplicities.