Package org.robwork.sdurw_geometry
Class IndexedTriMeshPtr
- java.lang.Object
-
- org.robwork.sdurw_geometry.IndexedTriMeshPtr
-
public class IndexedTriMeshPtr extends java.lang.Object
Ptr 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.TriMeshPtr
clone()
make a clone of this triangle meshvoid
delete()
IndexedTriMesh
deref()
The pointer stored in the object.boolean
equals(IndexedTriMesh p)
static long
getCPtr(IndexedTriMeshPtr obj)
IndexedTriMesh
getDeref()
Member access operator.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 meshlong
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.short
getTriangleStride()
The stride of a triangle.TriMeshPtr
getTriMesh()
TriMeshPtr
getTriMesh(boolean forceCopy)
GeometryData.GeometryType
getType()
Vector3D
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.double
getVolume()
calculate a volume of this triangle meshboolean
hasFaceNormals()
Check if trimesh has face normals defined.boolean
hasVertexNormals()
Check if trimesh has vertex normals defined.boolean
isConvex()
boolean
isNull()
checks if the pointer is nullboolean
isShared()
check if this Ptr has shared ownership or none
ownershipvoid
scale(double scale)
void
setConvexEnabled(boolean isConvex)
long
size()
java.lang.String
toString(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
-
-
-