Package org.robwork.sdurw_geometry
Class IndexedTriMesh
- java.lang.Object
-
- org.robwork.sdurw_geometry.GeometryData
-
- org.robwork.sdurw_geometry.TriMesh
-
- org.robwork.sdurw_geometry.IndexedTriMesh
-
- Direct Known Subclasses:
IndexedTriMeshN0
public class IndexedTriMesh extends TriMesh
Interface for indexed triangle meshes.
An indexed triangle mesh has a list of vertices and a list of
indicies. The indicies is used as reference into the vertex list.
Indicies are grouped into threes such that one triangle is defined
by three following indicies.
In the IndexedTriMesh classes the indice list is hidden under a list
of IndexedTriangle.
-
-
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 IndexedTriMesh(long cPtr, boolean cMemoryOwn)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete()
static long
getCPtr(IndexedTriMesh obj)
IndexedTriangle_32
getIndexedTriangle(long i)
get the indexed triangle at index iSWIGTYPE_p_unsigned_char
getIndexPtr()
Pointer to the start of the index array.short
getIndexSize()
The size of the index type used.SWIGTYPE_p_void
getIndices()
Get pointer to first element of index array.SWIGTYPE_p_std__vectorT_rw__math__Vector3DT_double_t_t
getNormals()
Get vector of normals.int
getNrTris()
The number of triangles in the meshshort
getTriangleStride()
The stride of a triangle.GeometryData.GeometryType
getType()
the type of this primitiveVector3D
getVertex(long i)
Get vertex from vertex list.Vector3D
getVertex(long i, VertexIdx vidx)
get vertex vidx of triangle at index i.Vector3D
getVertexNormal(long i, VertexIdx vidx)
Get normal of vertex vidx of triangle at index i.SWIGTYPE_p_std__vectorT_rw__math__Vector3DT_double_t_t
getVertices()
Get vector of vertices.boolean
hasFaceNormals()
Check if trimesh has face normals defined.boolean
hasVertexNormals()
Check if trimesh has vertex normals defined.void
scale(double scale)
Scale all vertices in the mesh.long
size()
gets the number of triangles in the triangle array.-
Methods inherited from class org.robwork.sdurw_geometry.TriMesh
clone, getCPtr, getSize, getTriangle, getTriangle, getTriangle, getTriMesh, getTriMesh, getVolume, isConvex, setConvexEnabled
-
Methods inherited from class org.robwork.sdurw_geometry.GeometryData
getCPtr, toString
-
-
-
-
Method Detail
-
getCPtr
public static long getCPtr(IndexedTriMesh obj)
-
getNormals
public SWIGTYPE_p_std__vectorT_rw__math__Vector3DT_double_t_t getNormals()
Get vector of normals.- Returns:
- reference to vector.
-
getVertices
public SWIGTYPE_p_std__vectorT_rw__math__Vector3DT_double_t_t getVertices()
Get vector of vertices.- Returns:
- reference to vector.
-
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()
Description copied from class:TriMesh
gets the number of triangles in the triangle array.
-
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.
-
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.
-
getVertex
public Vector3D getVertex(long i, VertexIdx vidx)
get vertex vidx of triangle at index i.- Parameters:
i
- [in] the index of the trianglevidx
- [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).
-
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
-
getType
public GeometryData.GeometryType getType()
Description copied from class:GeometryData
the type of this primitive- Overrides:
getType
in classGeometryData
-
getIndices
public SWIGTYPE_p_void getIndices()
Get pointer to first element of index array.- Returns:
- pointer to first element.
-
-