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