Interface MeshModel

All Superinterfaces:
Serializable
All Known Implementing Classes:
MeshModelImpl

public interface MeshModel extends Serializable
The main object for triangular meshes. Each mesh model consists of one or more mesh facets.
  • Method Details

    • setFacets

      void setFacets(List<MeshFacet> facets)
      change facets
      Parameters:
      facets - Facets of the mesh model
    • getFacets

      List<MeshFacet> getFacets()
      returns list of mesh facets
      Returns:
      list of mesh facets
    • addFacet

      void addFacet(MeshFacet facet)
      Adds a new mesh facet to the model.
      Parameters:
      facet - new mesh facet
    • removeFacet

      MeshFacet removeFacet(int index)
      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

      void addFacets(Collection<MeshFacet> newFacets)
      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

      void setMaterial(Material mtl)
      changes material of the model
      Parameters:
      mtl - Material
    • hasMaterial

      boolean hasMaterial()
      Returns:
      true if material exists
    • hasCurvature

      boolean hasCurvature()
      Returns true if the mesh vertices have set curvature values.
      Returns:
      true if the mesh vertices have set curvature values.
    • compute

      void compute(MeshVisitor visitor, boolean concurrently)
      Applies the visitor to all mesh facets. If the visitor is thread-safe and the concurrently is true, then the visitor is applied to all mesh facet concurrently using all CPU cores.
      Parameters:
      visitor - Visitor to be applied for the computation
      concurrently - Parallel computation
      Throws:
      NullPointerException - if the visitor is null
    • compute

      void compute(MeshVisitor visitor)
      Applies the visitor to all mesh facets sequentially.
      Parameters:
      visitor - Visitor to be applied for the computation
      Throws:
      NullPointerException - if the visitor is null
    • 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()
      Returns true if at least any vertex normals were automatically estimated. Returns false 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 - If true, then all normals are recomputed (estimated). If false, 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