Commit 4548c2ed authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Add rotate(AABB, Matrix3f) and forward declare AABB

parent 8d83cc63
......@@ -40,6 +40,7 @@
#include <stdexcept>
#include <hpp/fcl/math/vec_3f.h>
#include <hpp/fcl/math/matrix_3f.h>
namespace fcl
{
......@@ -243,6 +244,20 @@ static inline AABB translate(const AABB& aabb, const Vec3f& t)
return res;
}
static inline AABB rotate(const AABB& aabb, const Matrix3f& t)
{
AABB res (t * aabb.min_);
Vec3f corner (aabb.min_);
const std::size_t bit[3] = { 1, 2, 4 };
for (std::size_t ic = 1; ic < 8; ++ic) { // ic = 0 corresponds to aabb.min_. Skip it.
for (std::size_t i = 0; i < 3; ++i) {
corner[i] = (ic && bit[i]) ? aabb.max_[i] : aabb.min_[i];
}
res += t * corner;
}
return res;
}
}
#endif
......@@ -43,4 +43,6 @@ namespace fcl {
typedef boost::shared_ptr <const CollisionGeometry>
CollisionGeometryConstPtr_t;
class Transform3f;
class AABB;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment