com.bulletphysics.collision.narrowphase
Class VoronoiSimplexSolver

java.lang.Object
  extended by com.bulletphysics.collision.narrowphase.SimplexSolverInterface
      extended by com.bulletphysics.collision.narrowphase.VoronoiSimplexSolver

public class VoronoiSimplexSolver
extends SimplexSolverInterface

VoronoiSimplexSolver is an implementation of the closest point distance algorithm from a 1-4 points simplex to the origin. Can be used with GJK, as an alternative to Johnson distance algorithm.


Nested Class Summary
static class VoronoiSimplexSolver.SubSimplexClosestResult
           
static class VoronoiSimplexSolver.UsageBitfield
           
 
Field Summary
 VoronoiSimplexSolver.SubSimplexClosestResult cachedBC
           
 Vector3f cachedP1
           
 Vector3f cachedP2
           
 Vector3f cachedV
           
 boolean cachedValidClosest
           
 Vector3f lastW
           
 boolean needsUpdate
           
 int numVertices
           
 Vector3f[] simplexPointsP
           
 Vector3f[] simplexPointsQ
           
 Vector3f[] simplexVectorW
           
 
Constructor Summary
VoronoiSimplexSolver()
           
 
Method Summary
 void addVertex(Vector3f w, Vector3f p, Vector3f q)
           
 void backup_closest(Vector3f v)
           
 boolean closest(Vector3f v)
          Return/calculate the closest vertex.
 boolean closestPtPointTetrahedron(Vector3f p, Vector3f a, Vector3f b, Vector3f c, Vector3f d, VoronoiSimplexSolver.SubSimplexClosestResult finalResult)
           
 boolean closestPtPointTriangle(Vector3f p, Vector3f a, Vector3f b, Vector3f c, VoronoiSimplexSolver.SubSimplexClosestResult result)
           
 void compute_points(Vector3f p1, Vector3f p2)
           
 boolean emptySimplex()
           
 boolean fullSimplex()
           
 int getSimplex(Vector3f[] pBuf, Vector3f[] qBuf, Vector3f[] yBuf)
           
 boolean inSimplex(Vector3f w)
           
 float maxVertex()
           
 int numVertices()
           
static int pointOutsideOfPlane(Vector3f p, Vector3f a, Vector3f b, Vector3f c, Vector3f d)
           
 void reduceVertices(VoronoiSimplexSolver.UsageBitfield usedVerts)
           
 void removeVertex(int index)
           
 void reset()
          Clear the simplex, remove all the vertices.
 boolean updateClosestVectorAndPoints()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numVertices

public int numVertices

simplexVectorW

public final Vector3f[] simplexVectorW

simplexPointsP

public final Vector3f[] simplexPointsP

simplexPointsQ

public final Vector3f[] simplexPointsQ

cachedP1

public final Vector3f cachedP1

cachedP2

public final Vector3f cachedP2

cachedV

public final Vector3f cachedV

lastW

public final Vector3f lastW

cachedValidClosest

public boolean cachedValidClosest

cachedBC

public final VoronoiSimplexSolver.SubSimplexClosestResult cachedBC

needsUpdate

public boolean needsUpdate
Constructor Detail

VoronoiSimplexSolver

public VoronoiSimplexSolver()
Method Detail

removeVertex

public void removeVertex(int index)

reduceVertices

public void reduceVertices(VoronoiSimplexSolver.UsageBitfield usedVerts)

updateClosestVectorAndPoints

public boolean updateClosestVectorAndPoints()

closestPtPointTriangle

public boolean closestPtPointTriangle(Vector3f p,
                                      Vector3f a,
                                      Vector3f b,
                                      Vector3f c,
                                      VoronoiSimplexSolver.SubSimplexClosestResult result)

pointOutsideOfPlane

public static int pointOutsideOfPlane(Vector3f p,
                                      Vector3f a,
                                      Vector3f b,
                                      Vector3f c,
                                      Vector3f d)

closestPtPointTetrahedron

public boolean closestPtPointTetrahedron(Vector3f p,
                                         Vector3f a,
                                         Vector3f b,
                                         Vector3f c,
                                         Vector3f d,
                                         VoronoiSimplexSolver.SubSimplexClosestResult finalResult)

reset

public void reset()
Clear the simplex, remove all the vertices.

Specified by:
reset in class SimplexSolverInterface

addVertex

public void addVertex(Vector3f w,
                      Vector3f p,
                      Vector3f q)
Specified by:
addVertex in class SimplexSolverInterface

closest

public boolean closest(Vector3f v)
Return/calculate the closest vertex.

Specified by:
closest in class SimplexSolverInterface

maxVertex

public float maxVertex()
Specified by:
maxVertex in class SimplexSolverInterface

fullSimplex

public boolean fullSimplex()
Specified by:
fullSimplex in class SimplexSolverInterface

getSimplex

public int getSimplex(Vector3f[] pBuf,
                      Vector3f[] qBuf,
                      Vector3f[] yBuf)
Specified by:
getSimplex in class SimplexSolverInterface

inSimplex

public boolean inSimplex(Vector3f w)
Specified by:
inSimplex in class SimplexSolverInterface

backup_closest

public void backup_closest(Vector3f v)
Specified by:
backup_closest in class SimplexSolverInterface

emptySimplex

public boolean emptySimplex()
Specified by:
emptySimplex in class SimplexSolverInterface

compute_points

public void compute_points(Vector3f p1,
                           Vector3f p2)
Specified by:
compute_points in class SimplexSolverInterface

numVertices

public int numVertices()
Specified by:
numVertices in class SimplexSolverInterface