btSimplexSolverInterface.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. Bullet Continuous Collision Detection and Physics Library
  3. Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
  4. This software is provided 'as-is', without any express or implied warranty.
  5. In no event will the authors be held liable for any damages arising from the use of this software.
  6. Permission is granted to anyone to use this software for any purpose,
  7. including commercial applications, and to alter it and redistribute it freely,
  8. subject to the following restrictions:
  9. 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  10. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  11. 3. This notice may not be removed or altered from any source distribution.
  12. */
  13. #ifndef BT_SIMPLEX_SOLVER_INTERFACE_H
  14. #define BT_SIMPLEX_SOLVER_INTERFACE_H
  15. #include "bullet/LinearMath/btVector3.h"
  16. #define NO_VIRTUAL_INTERFACE 1
  17. #ifdef NO_VIRTUAL_INTERFACE
  18. #include "btVoronoiSimplexSolver.h"
  19. #define btSimplexSolverInterface btVoronoiSimplexSolver
  20. #else
  21. /// btSimplexSolverInterface can incrementally calculate distance between origin and up to 4 vertices
  22. /// Used by GJK or Linear Casting. Can be implemented by the Johnson-algorithm or alternative approaches based on
  23. /// voronoi regions or barycentric coordinates
  24. class btSimplexSolverInterface
  25. {
  26. public:
  27. virtual ~btSimplexSolverInterface() {};
  28. virtual void reset() = 0;
  29. virtual void addVertex(const btVector3& w, const btVector3& p, const btVector3& q) = 0;
  30. virtual bool closest(btVector3& v) = 0;
  31. virtual btScalar maxVertex() = 0;
  32. virtual bool fullSimplex() const = 0;
  33. virtual int getSimplex(btVector3 *pBuf, btVector3 *qBuf, btVector3 *yBuf) const = 0;
  34. virtual bool inSimplex(const btVector3& w) = 0;
  35. virtual void backup_closest(btVector3& v) = 0;
  36. virtual bool emptySimplex() const = 0;
  37. virtual void compute_points(btVector3& p1, btVector3& p2) = 0;
  38. virtual int numVertices() const =0;
  39. };
  40. #endif
  41. #endif //BT_SIMPLEX_SOLVER_INTERFACE_H