From 3b910491c383149cea2f1bb3d1ac2e454f769766 Mon Sep 17 00:00:00 2001 From: Irlan Date: Mon, 3 Jun 2019 14:32:58 -0300 Subject: [PATCH] Set AABB from center and radius --- include/bounce/collision/shapes/aabb3.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/bounce/collision/shapes/aabb3.h b/include/bounce/collision/shapes/aabb3.h index a9e562e..09ffb2c 100644 --- a/include/bounce/collision/shapes/aabb3.h +++ b/include/bounce/collision/shapes/aabb3.h @@ -60,6 +60,20 @@ struct b3AABB3 } } + // Set this AABB from a center point and a radius vector. + void Set(const b3Vec3& center, const b3Vec3& r) + { + m_lower = center - r; + m_upper = center + r; + } + + // Set this AABB from a center point and a radius value. + void Set(const b3Vec3& center, float32 radius) + { + b3Vec3 r(radius, radius, radius); + Set(center, r); + } + // Extend this AABB by a scalar. void Extend(float32 s) {