Package org.robwork.sdurw_geometry
Class PlainTriMeshN3
- java.lang.Object
-
- org.robwork.sdurw_geometry.GeometryData
-
- org.robwork.sdurw_geometry.TriMesh
-
- org.robwork.sdurw_geometry.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().
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.robwork.sdurw_geometry.TriMesh
TriMesh.TriCenterIterator, TriMesh.VerticeIterator
-
Nested classes/interfaces inherited from class org.robwork.sdurw_geometry.GeometryData
GeometryData.GeometryType
-
-
Constructor Summary
Constructors Constructor Description PlainTriMeshN3()
constructorPlainTriMeshN3(long initSize)
constructorPlainTriMeshN3(long cPtr, boolean cMemoryOwn)
PlainTriMeshN3(VectorTriangleN3 tris)
constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(PlainTriMeshN3Ptr triangles)
Add all triangles in the mesh triangles to thisvoid
add(TriangleN3 triangle)
add a triangle to the triangle mesh.void
clear()
Clears the list of trianglesTriMeshPtr
clone()
make a clone of this triangle meshvoid
delete()
TriangleN3
get(long i)
static long
getCPtr(PlainTriMeshN3 obj)
long
getSize()
gets the number of triangles in the triangle array.Triangle
getTriangle(long idx)
gets the triangle at index idx.void
getTriangle(long idx, Triangle dst)
gets the triangle at index idx.void
getTriangle(long idx, Triangle_f dst)
gets the triangle at index idx.VectorTriangleN3
getTriangles()
the vector of trianglesGeometryData.GeometryType
getType()
the type of this primitivevoid
resize(long i)
resize the triangle meshvoid
scale(double scale)
Scale all vertices in the mesh.void
set(long i, TriangleN3 d)
long
size()
gets the number of triangles in the triangle array.-
Methods inherited from class org.robwork.sdurw_geometry.TriMesh
getCPtr, getTriMesh, getTriMesh, getVolume, isConvex, setConvexEnabled
-
Methods inherited from class org.robwork.sdurw_geometry.GeometryData
getCPtr, toString
-
-
-
-
Constructor Detail
-
PlainTriMeshN3
public PlainTriMeshN3(long cPtr, boolean cMemoryOwn)
-
PlainTriMeshN3
public PlainTriMeshN3(long initSize)
constructor
-
PlainTriMeshN3
public PlainTriMeshN3()
constructor
-
PlainTriMeshN3
public PlainTriMeshN3(VectorTriangleN3 tris)
constructor
-
-
Method Detail
-
getCPtr
public static long getCPtr(PlainTriMeshN3 obj)
-
scale
public void scale(double scale)
Description copied from class:TriMesh
Scale all vertices in the mesh.
-
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
-
get
public TriangleN3 get(long i)
-
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 classTriMesh
- 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 classTriMesh
- 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 classTriMesh
- 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.
-
size
public long size()
Description copied from class:TriMesh
gets the number of triangles in the triangle array.
-
getType
public GeometryData.GeometryType getType()
Description copied from class:GeometryData
the type of this primitive- Overrides:
getType
in classGeometryData
-
clone
public TriMeshPtr clone()
Description copied from class:TriMesh
make a clone of this triangle mesh
-
-