Package org.robwork.sdurw_geometry
Class PlainTriMesh
- java.lang.Object
-
- org.robwork.sdurw_geometry.GeometryData
-
- org.robwork.sdurw_geometry.TriMesh
-
- org.robwork.sdurw_geometry.PlainTriMesh
-
public class PlainTriMesh 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 PlainTriMesh()
constructorPlainTriMesh(long initSize)
constructorPlainTriMesh(long cPtr, boolean cMemoryOwn)
PlainTriMesh(VectorTriangle tris)
constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(PlainTriMeshPtr triangles)
Add all triangles in the mesh triangles to thisvoid
add(Triangle triangle)
add a triangle to the triangle mesh.void
clear()
Clears the list of trianglesTriMeshPtr
clone()
make a clone of this triangle meshvoid
delete()
Triangle
get(long i)
static long
getCPtr(PlainTriMesh 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.VectorTriangle
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, Triangle 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
-
PlainTriMesh
public PlainTriMesh(long cPtr, boolean cMemoryOwn)
-
PlainTriMesh
public PlainTriMesh(long initSize)
constructor
-
PlainTriMesh
public PlainTriMesh()
constructor
-
PlainTriMesh
public PlainTriMesh(VectorTriangle tris)
constructor
-
-
Method Detail
-
getCPtr
public static long getCPtr(PlainTriMesh obj)
-
scale
public void scale(double scale)
Description copied from class:TriMesh
Scale all vertices in the mesh.
-
add
public void add(Triangle triangle)
add a triangle to the triangle mesh.- Parameters:
triangle
- [in] Triangle to add. The triangle is copied.
-
add
public void add(PlainTriMeshPtr triangles)
Add all triangles in the mesh triangles to this
-
clear
public void clear()
Clears the list of triangles
-
getTriangles
public VectorTriangle getTriangles()
the vector of triangles- Returns:
- a reference to the triangle vector
-
get
public Triangle get(long i)
-
set
public void set(long i, Triangle 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
-
-