Class PlainTriMeshN3


  • public class PlainTriMeshN3
    extends TriMesh

    a triangle mesh representation that maintains a list of simple triangles.

    This class is templated and can be setup with different types of triangle storage.
    Mainly this concerns single or double precision but also number of normals in each Triangle.
    Check out Triangle.hpp to get an idea of the different types.

    The PlainTriMesh can be used as follows
    // create trimesh PlainTriMesh<TriangleN1<float> > mesh; // add data mesh.add( TriangleN1<float>(v1,v2,v3) ); mesh.add( TriangleN1<float>(v1,v2,v3) ); mesh.add( TriangleN1<float>(v1,v2,v3) ); // and access the mesh TriangleN1<float> tri_index1 = mesh[1]; Vector3D<float> normal = mesh[2].getFaceNormal();

    To convert the plain trimesh to a more efficient mesh representation take a look at
    TriangleUtil::toIndexedTriMesh().
    • Constructor Detail

      • PlainTriMeshN3

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

        public PlainTriMeshN3​(long initSize)
        constructor
      • PlainTriMeshN3

        public PlainTriMeshN3()
        constructor
    • Method Detail

      • delete

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

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

        public void add​(TriangleN3 triangle)
        add a triangle to the triangle mesh.
        Parameters:
        triangle - [in] Triangle to add. The triangle is copied.
      • add

        public void add​(PlainTriMeshN3Ptr triangles)
        Add all triangles in the mesh triangles to this
      • clear

        public void clear()
        Clears the list of triangles
      • getTriangles

        public VectorTriangleN3 getTriangles()
        the vector of triangles
        Returns:
        a reference to the triangle vector
      • set

        public void set​(long i,
                        TriangleN3 d)
      • resize

        public void resize​(long i)
        resize the triangle mesh
        Parameters:
        i - [in] new size of mesh.
      • getTriangle

        public Triangle getTriangle​(long idx)
        Description copied from class: TriMesh
        gets the triangle at index idx.
        Overrides:
        getTriangle in class TriMesh
        Parameters:
        idx - [in] the index of the triangle.
        Returns:
        the triangle at index idx
      • getTriangle

        public void getTriangle​(long idx,
                                Triangle dst)
        Description copied from class: TriMesh
        gets the triangle at index idx.
        Overrides:
        getTriangle in class TriMesh
        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)
        Description copied from class: TriMesh
        gets the triangle at index idx. Using Floating point presicion
        Overrides:
        getTriangle in class TriMesh
        Parameters:
        idx - [in] the index of the triangle.
        dst - [out] where to store the triangle at index idx
      • getSize

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

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

        public TriMeshPtr clone()
        Description copied from class: TriMesh
        make a clone of this triangle mesh
        Overrides:
        clone in class TriMesh
        Returns:
        clone of this trimesh