Class IndexedTriMesh

  • Direct Known Subclasses:
    IndexedTriMeshN0

    public class IndexedTriMesh
    extends TriMesh
    Interface for indexed triangle meshes.

    An indexed triangle mesh has a list of vertices and a list of
    indicies. The indicies is used as reference into the vertex list.
    Indicies are grouped into threes such that one triangle is defined
    by three following indicies.

    In the IndexedTriMesh classes the indice list is hidden under a list
    of IndexedTriangle.
    • Constructor Detail

      • IndexedTriMesh

        public IndexedTriMesh​(long cPtr,
                              boolean cMemoryOwn)
    • Method Detail

      • delete

        public void delete()
        Overrides:
        delete in class TriMesh
      • getTriangleStride

        public short getTriangleStride()
        The stride of a triangle.
        Returns:
        the stride.
      • getIndexSize

        public short getIndexSize()
        The size of the index type used.
        Returns:
        Typically 2 (uint16_t) or 4 (uint32_t).
      • getIndexPtr

        public SWIGTYPE_p_unsigned_char getIndexPtr()
        Pointer to the start of the index array.
        Returns:
        pointer to byte array.
      • size

        public long size()
        Description copied from class: TriMesh
        gets the number of triangles in the triangle array.
        Overrides:
        size in class TriMesh
      • getVertex

        public Vector3D getVertex​(long i)
        Get vertex from vertex list.
        Parameters:
        i - [in] the vertex id (NOT the triangle id).
        Returns:
        a reference to the vertex.
      • hasVertexNormals

        public boolean hasVertexNormals()
        Check if trimesh has vertex normals defined.
        Returns:
        true if vertex normals are defined.
      • hasFaceNormals

        public boolean hasFaceNormals()
        Check if trimesh has face normals defined.
        Returns:
        true if face normals are defined.
      • getVertexNormal

        public Vector3D getVertexNormal​(long i,
                                        VertexIdx vidx)
        Get normal of vertex vidx of triangle at index i.
        Parameters:
        i - [in] the index of the triangle.
        vidx - [in] the triangle vertex.
        Returns:
        reference to normal vector.
        Warning: Using the virtual function comes with a performance penalty.
        If possible, use functions implemented on subtypes directly.
      • getVertex

        public Vector3D getVertex​(long i,
                                  VertexIdx vidx)
        get vertex vidx of triangle at index i.
        Parameters:
        i - [in] the index of the triangle
        vidx - [in] the index of the triangle vertex
        Returns:
        reference to vertex.
        Warning: Using the virtual function comes with a performance penalty.
        If possible, use functions implemented on subtypes directly (like
        IndexedTriMeshN0::getTriVertex).
      • getIndexedTriangle

        public IndexedTriangle_32 getIndexedTriangle​(long i)
        get the indexed triangle at index i
        Parameters:
        i - [in] the index of the triangle
        Returns:
        an indexed triangle
        Warning: Using the virtual function comes with a performance penalty.
        If possible, use functions implemented on subtypes directly.
      • getNrTris

        public int getNrTris()
        The number of triangles in the mesh
        Returns:
        nr of triangles
      • getIndices

        public SWIGTYPE_p_void getIndices()
        Get pointer to first element of index array.
        Returns:
        pointer to first element.
      • scale

        public void scale​(double scale)
        Description copied from class: TriMesh
        Scale all vertices in the mesh.
        Overrides:
        scale in class TriMesh