Class MeshModelImpl

java.lang.Object
cz.fidentis.analyst.data.mesh.impl.MeshModelImpl
All Implemented Interfaces:
MeshModel, Serializable

public class MeshModelImpl extends Object implements MeshModel
The main object for triangular meshes. Each mesh model consists of one or more mesh facets.
See Also:
  • Constructor Details

    • MeshModelImpl

      public MeshModelImpl()
      Constructor of MeshModel
    • MeshModelImpl

      public MeshModelImpl(MeshModel meshModel)
      Copy constructor of MeshModel
      Parameters:
      meshModel - copied MeshModel
  • Method Details

    • setFacets

      public void setFacets(List<MeshFacet> facets)
      Description copied from interface: MeshModel
      change facets
      Specified by:
      setFacets in interface MeshModel
      Parameters:
      facets - Facets of the mesh model
    • getFacets

      public List<MeshFacet> getFacets()
      Description copied from interface: MeshModel
      returns list of mesh facets
      Specified by:
      getFacets in interface MeshModel
      Returns:
      list of mesh facets
    • addFacet

      public void addFacet(MeshFacet facet)
      Description copied from interface: MeshModel
      Adds a new mesh facet to the model.
      Specified by:
      addFacet in interface MeshModel
      Parameters:
      facet - new mesh facet
    • removeFacet

      public MeshFacet removeFacet(int index)
      Description copied from interface: MeshModel
      Removes facet from the model.
      Specified by:
      removeFacet in interface MeshModel
      Parameters:
      index - Index of the facet
      Returns:
      Removed facet or null
    • addFacets

      public void addFacets(Collection<MeshFacet> newFacets)
      Description copied from interface: MeshModel
      Adds a new mesh facets to the model.
      Specified by:
      addFacets in interface MeshModel
      Parameters:
      newFacets - collection of new facets
    • getMaterial

      public Material getMaterial()
      Description copied from interface: MeshModel
      gets the material of the model
      Specified by:
      getMaterial in interface MeshModel
      Returns:
      material
    • setMaterial

      public void setMaterial(Material mtl)
      Description copied from interface: MeshModel
      changes material of the model
      Specified by:
      setMaterial in interface MeshModel
      Parameters:
      mtl - Material
    • hasMaterial

      public boolean hasMaterial()
      Specified by:
      hasMaterial in interface MeshModel
      Returns:
      true if material exists
    • hasCurvature

      public boolean hasCurvature()
      Description copied from interface: MeshModel
      Returns true if the mesh vertices have set curvature values.
      Specified by:
      hasCurvature in interface MeshModel
      Returns:
      true if the mesh vertices have set curvature values.
    • compute

      public void compute(MeshVisitor visitor, boolean concurrently)
      Description copied from interface: MeshModel
      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.
      Specified by:
      compute in interface MeshModel
      Parameters:
      visitor - Visitor to be applied for the computation
      concurrently - Parallel computation
    • compute

      public void compute(MeshVisitor visitor)
      Description copied from interface: MeshModel
      Applies the visitor to all mesh facets sequentially.
      Specified by:
      compute in interface MeshModel
      Parameters:
      visitor - Visitor to be applied for the computation
    • simplifyModel

      public void simplifyModel()
      Description copied from interface: MeshModel
      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:
      simplifyModel in interface MeshModel
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getNumVertices

      public long getNumVertices()
      Description copied from interface: MeshModel
      Returns number of vertices (sum of all facets).
      Specified by:
      getNumVertices in interface MeshModel
      Returns:
      Number of vertices
    • getCentroid

      public javax.vecmath.Point3d getCentroid()
      Description copied from interface: MeshModel
      Returns central point computed from mesh vertices
      Specified by:
      getCentroid in interface MeshModel
      Returns:
      centroid
    • hasEstimatedVertNormals

      public boolean hasEstimatedVertNormals()
      Description copied from interface: MeshModel
      Returns true if at least any vertex normals were automatically estimated. Returns false if all vertex normals were predefined in the mesh file
      Specified by:
      hasEstimatedVertNormals in interface MeshModel
      Returns:
      true if at least any vertex normals were automatically estimated.
    • estimateVertexNormals

      public boolean estimateVertexNormals(boolean recomputeAll)
      Description copied from interface: MeshModel
      Recomputes normals of vertices.
      Specified by:
      estimateVertexNormals in interface MeshModel
      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