b3ConvexUtility.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. Copyright (c) 2012 Advanced Micro Devices, Inc.
  3. This software is provided 'as-is', without any express or implied warranty.
  4. In no event will the authors be held liable for any damages arising from the use of this software.
  5. Permission is granted to anyone to use this software for any purpose,
  6. including commercial applications, and to alter it and redistribute it freely,
  7. subject to the following restrictions:
  8. 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.
  9. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  10. 3. This notice may not be removed or altered from any source distribution.
  11. */
  12. //Originally written by Erwin Coumans
  13. #ifndef _BT_CONVEX_UTILITY_H
  14. #define _BT_CONVEX_UTILITY_H
  15. #include "Bullet3Common/b3AlignedObjectArray.h"
  16. #include "Bullet3Common/b3Transform.h"
  17. struct b3MyFace
  18. {
  19. b3AlignedObjectArray<int> m_indices;
  20. b3Scalar m_plane[4];
  21. };
  22. B3_ATTRIBUTE_ALIGNED16(class)
  23. b3ConvexUtility
  24. {
  25. public:
  26. B3_DECLARE_ALIGNED_ALLOCATOR();
  27. b3Vector3 m_localCenter;
  28. b3Vector3 m_extents;
  29. b3Vector3 mC;
  30. b3Vector3 mE;
  31. b3Scalar m_radius;
  32. b3AlignedObjectArray<b3Vector3> m_vertices;
  33. b3AlignedObjectArray<b3MyFace> m_faces;
  34. b3AlignedObjectArray<b3Vector3> m_uniqueEdges;
  35. b3ConvexUtility()
  36. {
  37. }
  38. virtual ~b3ConvexUtility();
  39. bool initializePolyhedralFeatures(const b3Vector3* orgVertices, int numVertices, bool mergeCoplanarTriangles = true);
  40. void initialize();
  41. bool testContainment() const;
  42. };
  43. #endif