com.bulletphysics.collision.shapes
Class ConvexHullShape
java.lang.Object
com.bulletphysics.collision.shapes.CollisionShape
com.bulletphysics.collision.shapes.ConvexShape
com.bulletphysics.collision.shapes.ConvexInternalShape
com.bulletphysics.collision.shapes.PolyhedralConvexShape
com.bulletphysics.collision.shapes.ConvexHullShape
public class ConvexHullShape
- extends PolyhedralConvexShape
ConvexHullShape implements an implicit convex hull of an array of vertices.
Bullet provides a general and fast collision detector for convex shapes based
on GJK and EPA using localGetSupportingVertex.
Method Summary |
void |
addPoint(Vector3f point)
|
void |
batchedUnitVectorGetSupportingVertexWithoutMargin(Vector3f[] vectors,
Vector3f[] supportVerticesOut,
int numVectors)
|
void |
getEdge(int i,
Vector3f pa,
Vector3f pb)
|
String |
getName()
|
int |
getNumEdges()
|
int |
getNumPlanes()
|
int |
getNumPoints()
|
int |
getNumVertices()
Currently just for debugging (drawing), perhaps future support for algebraic continuous collision detection. |
void |
getPlane(Vector3f planeNormal,
Vector3f planeSupport,
int i)
|
ObjectArrayList<Vector3f> |
getPoints()
|
BroadphaseNativeType |
getShapeType()
|
void |
getVertex(int i,
Vector3f vtx)
|
boolean |
isInside(Vector3f pt,
float tolerance)
|
Vector3f |
localGetSupportingVertex(Vector3f vec,
Vector3f out)
|
Vector3f |
localGetSupportingVertexWithoutMargin(Vector3f vec0,
Vector3f out)
|
void |
setLocalScaling(Vector3f scaling)
|
ConvexHullShape
public ConvexHullShape(ObjectArrayList<Vector3f> points)
- TODO: This constructor optionally takes in a pointer to points. Each point is assumed to be 3 consecutive float (x,y,z), the striding defines the number of bytes between each point, in memory.
It is easier to not pass any points in the constructor, and just add one point at a time, using addPoint.
ConvexHullShape make an internal copy of the points.
setLocalScaling
public void setLocalScaling(Vector3f scaling)
- Overrides:
setLocalScaling
in class PolyhedralConvexShape
addPoint
public void addPoint(Vector3f point)
getPoints
public ObjectArrayList<Vector3f> getPoints()
getNumPoints
public int getNumPoints()
localGetSupportingVertexWithoutMargin
public Vector3f localGetSupportingVertexWithoutMargin(Vector3f vec0,
Vector3f out)
- Overrides:
localGetSupportingVertexWithoutMargin
in class PolyhedralConvexShape
batchedUnitVectorGetSupportingVertexWithoutMargin
public void batchedUnitVectorGetSupportingVertexWithoutMargin(Vector3f[] vectors,
Vector3f[] supportVerticesOut,
int numVectors)
- Overrides:
batchedUnitVectorGetSupportingVertexWithoutMargin
in class PolyhedralConvexShape
localGetSupportingVertex
public Vector3f localGetSupportingVertex(Vector3f vec,
Vector3f out)
- Overrides:
localGetSupportingVertex
in class ConvexInternalShape
getNumVertices
public int getNumVertices()
- Currently just for debugging (drawing), perhaps future support for algebraic continuous collision detection.
Please note that you can debug-draw ConvexHullShape with the Raytracer Demo.
- Specified by:
getNumVertices
in class PolyhedralConvexShape
getNumEdges
public int getNumEdges()
- Specified by:
getNumEdges
in class PolyhedralConvexShape
getEdge
public void getEdge(int i,
Vector3f pa,
Vector3f pb)
- Specified by:
getEdge
in class PolyhedralConvexShape
getVertex
public void getVertex(int i,
Vector3f vtx)
- Specified by:
getVertex
in class PolyhedralConvexShape
getNumPlanes
public int getNumPlanes()
- Specified by:
getNumPlanes
in class PolyhedralConvexShape
getPlane
public void getPlane(Vector3f planeNormal,
Vector3f planeSupport,
int i)
- Specified by:
getPlane
in class PolyhedralConvexShape
isInside
public boolean isInside(Vector3f pt,
float tolerance)
- Specified by:
isInside
in class PolyhedralConvexShape
getShapeType
public BroadphaseNativeType getShapeType()
- Specified by:
getShapeType
in class CollisionShape
getName
public String getName()
- Specified by:
getName
in class CollisionShape