Class IndexedTriMeshPtr


  • public class IndexedTriMeshPtr
    extends java.lang.Object
    Ptr stores a pointer and optionally takes ownership of the value.
    • Constructor Detail

      • IndexedTriMeshPtr

        public IndexedTriMeshPtr​(long cPtr,
                                 boolean cMemoryOwn)
      • IndexedTriMeshPtr

        public IndexedTriMeshPtr()
        Default constructor yielding a NULL-pointer.
      • IndexedTriMeshPtr

        public IndexedTriMeshPtr​(IndexedTriMesh ptr)
        Do not take ownership of ptr.

        ptr can be null.

        The constructor is implicit on purpose.
    • Method Detail

      • delete

        public void delete()
      • deref

        public IndexedTriMesh deref()
        The pointer stored in the object.
      • isShared

        public boolean isShared()
        check if this Ptr has shared ownership or none
        ownership
        Returns:
        true if Ptr has shared ownership, false if it has no ownership.
      • isNull

        public boolean isNull()
        checks if the pointer is null
        Returns:
        Returns true if the pointer is null
      • 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()
      • 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.
      • 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).
      • 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.
      • 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)
      • getTriangle

        public Triangle getTriangle​(long idx)
        gets the triangle at index idx.
        Parameters:
        idx - [in] the index of the triangle.
        Returns:
        the triangle at index idx
      • getTriangle

        public void getTriangle​(long idx,
                                Triangle dst)
        gets the triangle at index idx.
        Parameters:
        idx - [in] the index of the triangle.
        dst - [out] where to store the triangle at index idx
      • getTriangle

        public void getTriangle​(long idx,
                                Triangle_f dst)
        gets the triangle at index idx. Using Floating point presicion
        Parameters:
        idx - [in] the index of the triangle.
        dst - [out] where to store the triangle at index idx
      • getSize

        public long getSize()
        gets the number of triangles in the triangle array.
      • clone

        public TriMeshPtr clone()
        make a clone of this triangle mesh
        Returns:
        clone of this trimesh
      • getTriMesh

        public TriMeshPtr getTriMesh​(boolean forceCopy)
      • isConvex

        public boolean isConvex()
      • setConvexEnabled

        public void setConvexEnabled​(boolean isConvex)
      • getVolume

        public double getVolume()
        calculate a volume of this triangle mesh
      • toString

        public java.lang.String toString​(GeometryData.GeometryType type)
        format GeometryType to string
        Parameters:
        type -