com.bulletphysics.collision.shapes
Class ConvexHullShape

java.lang.Object
  extended by com.bulletphysics.collision.shapes.CollisionShape
      extended by com.bulletphysics.collision.shapes.ConvexShape
          extended by com.bulletphysics.collision.shapes.ConvexInternalShape
              extended by com.bulletphysics.collision.shapes.PolyhedralConvexShape
                  extended by com.bulletphysics.collision.shapes.ConvexHullShape

public class ConvexHullShape
extends PolyhedralConvexShape

ConvexHullShape implements an implicit (getSupportingVertex) Convex Hull of a Point Cloud (vertices). No connectivity is needed. localGetSupportingVertex iterates linearly though all vertices. On modern hardware, due to cache coherency this isn't that bad. Complex algorithms tend to trash the cashe (memory is much slower then the cpu).


Field Summary
 
Fields inherited from class com.bulletphysics.collision.shapes.PolyhedralConvexShape
isLocalAabbValid, localAabbMax, localAabbMin
 
Fields inherited from class com.bulletphysics.collision.shapes.ConvexInternalShape
collisionMargin, implicitShapeDimensions, localScaling
 
Fields inherited from class com.bulletphysics.collision.shapes.ConvexShape
MAX_PREFERRED_PENETRATION_DIRECTIONS
 
Constructor Summary
ConvexHullShape(java.util.List<javax.vecmath.Vector3f> points)
          TODO: This constructor optionally takes in a pointer to points.
 
Method Summary
 void addPoint(javax.vecmath.Vector3f point)
           
 void batchedUnitVectorGetSupportingVertexWithoutMargin(javax.vecmath.Vector3f[] vectors, javax.vecmath.Vector3f[] supportVerticesOut, int numVectors)
           
 void getEdge(int i, javax.vecmath.Vector3f pa, javax.vecmath.Vector3f pb)
           
 java.lang.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(javax.vecmath.Vector3f planeNormal, javax.vecmath.Vector3f planeSupport, int i)
           
 java.util.List<javax.vecmath.Vector3f> getPoints()
           
 BroadphaseNativeType getShapeType()
           
 void getVertex(int i, javax.vecmath.Vector3f vtx)
           
 boolean isInside(javax.vecmath.Vector3f pt, float tolerance)
           
 javax.vecmath.Vector3f localGetSupportingVertex(javax.vecmath.Vector3f vec, javax.vecmath.Vector3f out)
           
 javax.vecmath.Vector3f localGetSupportingVertexWithoutMargin(javax.vecmath.Vector3f vec0, javax.vecmath.Vector3f out)
           
 
Methods inherited from class com.bulletphysics.collision.shapes.PolyhedralConvexShape
_PolyhedralConvexShape_getAabb, calculateLocalInertia, getAabb, recalcLocalAabb
 
Methods inherited from class com.bulletphysics.collision.shapes.ConvexInternalShape
getAabbSlow, getLocalScaling, getMargin, getNumPreferredPenetrationDirections, getPreferredPenetrationDirection, setLocalScaling, setMargin
 
Methods inherited from class com.bulletphysics.collision.shapes.CollisionShape
calculateTemporalAabb, getAngularMotionDisc, getBoundingSphere, getUserPointer, isCompound, isConcave, isConvex, isInfinite, isPolyhedral, setUserPointer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConvexHullShape

public ConvexHullShape(java.util.List<javax.vecmath.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.

Method Detail

addPoint

public void addPoint(javax.vecmath.Vector3f point)

getPoints

public java.util.List<javax.vecmath.Vector3f> getPoints()

getNumPoints

public int getNumPoints()

localGetSupportingVertexWithoutMargin

public javax.vecmath.Vector3f localGetSupportingVertexWithoutMargin(javax.vecmath.Vector3f vec0,
                                                                    javax.vecmath.Vector3f out)
Overrides:
localGetSupportingVertexWithoutMargin in class PolyhedralConvexShape

batchedUnitVectorGetSupportingVertexWithoutMargin

public void batchedUnitVectorGetSupportingVertexWithoutMargin(javax.vecmath.Vector3f[] vectors,
                                                              javax.vecmath.Vector3f[] supportVerticesOut,
                                                              int numVectors)
Overrides:
batchedUnitVectorGetSupportingVertexWithoutMargin in class PolyhedralConvexShape

localGetSupportingVertex

public javax.vecmath.Vector3f localGetSupportingVertex(javax.vecmath.Vector3f vec,
                                                       javax.vecmath.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,
                    javax.vecmath.Vector3f pa,
                    javax.vecmath.Vector3f pb)
Specified by:
getEdge in class PolyhedralConvexShape

getVertex

public void getVertex(int i,
                      javax.vecmath.Vector3f vtx)
Specified by:
getVertex in class PolyhedralConvexShape

getNumPlanes

public int getNumPlanes()
Specified by:
getNumPlanes in class PolyhedralConvexShape

getPlane

public void getPlane(javax.vecmath.Vector3f planeNormal,
                     javax.vecmath.Vector3f planeSupport,
                     int i)
Specified by:
getPlane in class PolyhedralConvexShape

isInside

public boolean isInside(javax.vecmath.Vector3f pt,
                        float tolerance)
Specified by:
isInside in class PolyhedralConvexShape

getShapeType

public BroadphaseNativeType getShapeType()
Specified by:
getShapeType in class CollisionShape

getName

public java.lang.String getName()
Specified by:
getName in class CollisionShape