Package org.robwork.sdurw_geometry
Class IndexedTriMeshPtr
- java.lang.Object
-
- org.robwork.sdurw_geometry.IndexedTriMeshPtr
-
public class IndexedTriMeshPtr extends java.lang.ObjectPtr stores a pointer and optionally takes ownership of the value.
-
-
Constructor Summary
Constructors Constructor Description IndexedTriMeshPtr()Default constructor yielding a NULL-pointer.IndexedTriMeshPtr(long cPtr, boolean cMemoryOwn)IndexedTriMeshPtr(IndexedTriMesh ptr)Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IndexedTriMesh__ref__()Dereferencing operator.TriMeshPtrclone()make a clone of this triangle meshvoiddelete()IndexedTriMeshderef()The pointer stored in the object.booleanequals(IndexedTriMesh p)static longgetCPtr(IndexedTriMeshPtr obj)IndexedTriMeshgetDeref()Member access operator.IndexedTriangle_32getIndexedTriangle(long i)get the indexed triangle at index iSWIGTYPE_p_unsigned_chargetIndexPtr()Pointer to the start of the index array.shortgetIndexSize()The size of the index type used.SWIGTYPE_p_voidgetIndices()Get pointer to first element of index array.SWIGTYPE_p_std__vectorT_rw__math__Vector3DT_double_t_tgetNormals()Get vector of normals.intgetNrTris()The number of triangles in the meshlonggetSize()gets the number of triangles in the triangle array.TrianglegetTriangle(long idx)gets the triangle at index idx.voidgetTriangle(long idx, Triangle dst)gets the triangle at index idx.voidgetTriangle(long idx, Triangle_f dst)gets the triangle at index idx.shortgetTriangleStride()The stride of a triangle.TriMeshPtrgetTriMesh()TriMeshPtrgetTriMesh(boolean forceCopy)GeometryData.GeometryTypegetType()Vector3DgetVertex(long i)Get vertex from vertex list.Vector3DgetVertex(long i, VertexIdx vidx)get vertex vidx of triangle at index i.Vector3DgetVertexNormal(long i, VertexIdx vidx)Get normal of vertex vidx of triangle at index i.SWIGTYPE_p_std__vectorT_rw__math__Vector3DT_double_t_tgetVertices()Get vector of vertices.doublegetVolume()calculate a volume of this triangle meshbooleanhasFaceNormals()Check if trimesh has face normals defined.booleanhasVertexNormals()Check if trimesh has vertex normals defined.booleanisConvex()booleanisNull()checks if the pointer is nullbooleanisShared()check if this Ptr has shared ownership or none
ownershipvoidscale(double scale)voidsetConvexEnabled(boolean isConvex)longsize()java.lang.StringtoString(GeometryData.GeometryType type)format GeometryType to string
-
-
-
Constructor Detail
-
IndexedTriMeshPtr
public IndexedTriMeshPtr(long cPtr, boolean cMemoryOwn)
-
IndexedTriMeshPtr
public IndexedTriMeshPtr()
Default constructor yielding a NULL-pointer.
-
IndexedTriMeshPtr
public IndexedTriMeshPtr(IndexedTriMesh ptr)
Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
-
-
Method Detail
-
getCPtr
public static long getCPtr(IndexedTriMeshPtr obj)
-
delete
public void delete()
-
deref
public IndexedTriMesh deref()
The pointer stored in the object.
-
__ref__
public IndexedTriMesh __ref__()
Dereferencing operator.
-
getDeref
public IndexedTriMesh getDeref()
Member access operator.
-
equals
public boolean equals(IndexedTriMesh p)
-
isShared
public boolean isShared()
check if this Ptr has shared ownership or none
ownership- Returns:
- true if Ptr has shared ownership, false if it has no ownership.
-
isNull
public boolean isNull()
checks if the pointer is null- Returns:
- Returns true if the pointer is null
-
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()
-
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.
-
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).
-
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.
-
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()
-
getIndices
public SWIGTYPE_p_void getIndices()
Get pointer to first element of index array.- Returns:
- pointer to first element.
-
scale
public void scale(double scale)
-
getTriangle
public Triangle getTriangle(long idx)
gets the triangle at index idx.- Parameters:
idx- [in] the index of the triangle.- Returns:
- the triangle at index idx
-
getTriangle
public void getTriangle(long idx, Triangle dst)gets the triangle at index idx.- 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)gets the triangle at index idx. Using Floating point presicion- Parameters:
idx- [in] the index of the triangle.dst- [out] where to store the triangle at index idx
-
getSize
public long getSize()
gets the number of triangles in the triangle array.
-
clone
public TriMeshPtr clone()
make a clone of this triangle mesh- Returns:
- clone of this trimesh
-
getTriMesh
public TriMeshPtr getTriMesh(boolean forceCopy)
-
getTriMesh
public TriMeshPtr getTriMesh()
-
isConvex
public boolean isConvex()
-
setConvexEnabled
public void setConvexEnabled(boolean isConvex)
-
getVolume
public double getVolume()
calculate a volume of this triangle mesh
-
toString
public java.lang.String toString(GeometryData.GeometryType type)
format GeometryType to string- Parameters:
type-
-
-