enumerate aabb vertices

This commit is contained in:
Irlan
2018-04-12 15:00:00 -03:00
parent 144c9cfc99
commit f8bb0cfc27
2 changed files with 48 additions and 24 deletions

View File

@ -21,12 +21,41 @@
#include <bounce/common/math/transform.h>
enum b3AABB3Vertex
{
e_leftDownBackVertex,
e_rightDownBackVertex,
e_rightUpBackVertex,
e_leftUpBackVertex,
e_leftDownFrontVertex,
e_rightDownFrontVertex,
e_rightUpFrontVertex,
e_leftUpFrontVertex,
e_aabb3VertexCount
};
// A min-max representation of a three-dimensional AABB.
struct b3AABB3
struct b3AABB3
{
b3Vec3 m_lower; // lower vertex
b3Vec3 m_upper; // upper vertex
// Get the AABB corners enumerated using b3AABB3Vertex.
void GetVertices(b3Vec3 out[e_aabb3VertexCount]) const
{
out[e_leftDownBackVertex].Set(m_lower.x, m_lower.y, m_lower.z);
out[e_rightDownBackVertex].Set(m_upper.x, m_lower.y, m_lower.z);
out[e_rightUpBackVertex].Set(m_upper.x, m_upper.y, m_lower.z);
out[e_leftUpBackVertex].Set(m_lower.x, m_upper.y, m_lower.z);
out[e_leftDownFrontVertex].Set(m_lower.x, m_lower.y, m_upper.z);
out[e_rightDownFrontVertex].Set(m_upper.x, m_lower.y, m_upper.z);
out[e_rightUpFrontVertex].Set(m_upper.x, m_upper.y, m_upper.z);
out[e_leftUpFrontVertex].Set(m_lower.x, m_upper.y, m_upper.z);
}
// Get the support vertex in a given direction.
b3Vec3 GetSupportVertex(const b3Vec3& direction) const
{