19 const array<int32_t, 3> BoundingBox::FACE0_INDICES = {{ 0, 4, 7 }};
20 const array<int32_t, 3> BoundingBox::FACE1_INDICES = {{ 7, 3, 0 }};
21 const array<int32_t, 3> BoundingBox::FACE2_INDICES = {{ 6, 5, 1 }};
22 const array<int32_t, 3> BoundingBox::FACE3_INDICES = {{ 1, 2, 6 }};
23 const array<int32_t, 3> BoundingBox::FACE4_INDICES = {{ 5, 4, 0 }};
24 const array<int32_t, 3> BoundingBox::FACE5_INDICES = {{ 0, 1, 5 }};
25 const array<int32_t, 3> BoundingBox::FACE6_INDICES = {{ 3, 7, 6 }};
26 const array<int32_t, 3> BoundingBox::FACE7_INDICES = {{ 6, 2, 3 }};
27 const array<int32_t, 3> BoundingBox::FACE8_INDICES = {{ 2, 1, 0 }};
28 const array<int32_t, 3> BoundingBox::FACE9_INDICES = {{ 0, 3, 2 }};
29 const array<int32_t, 3> BoundingBox::FACE10_INDICES = {{ 4, 5, 6 }};
30 const array<int32_t, 3> BoundingBox::FACE11_INDICES = {{ 6, 7, 4 }};
31 const array<array<int32_t,3>,12> BoundingBox::facesVerticesIndexes =
33 FACE0_INDICES, FACE1_INDICES, FACE2_INDICES, FACE3_INDICES,
34 FACE4_INDICES, FACE5_INDICES, FACE6_INDICES, FACE7_INDICES,
35 FACE8_INDICES, FACE9_INDICES, FACE10_INDICES, FACE11_INDICES
38 BoundingBox::BoundingBox()
83 for (
auto i = 0; i <
vertices.size(); i++) {
89 for (
auto vertexIndex = 1; vertexIndex <
vertices.size(); vertexIndex++) {
90 const auto& vertex =
vertices[vertexIndex];
91 if (vertex[0] < minX) minX = vertex[0];
92 if (vertex[1] < minY) minY = vertex[1];
93 if (vertex[2] < minZ) minZ = vertex[2];
94 if (vertex[0] > maxX) maxX = vertex[0];
95 if (vertex[1] > maxY) maxY = vertex[1];
96 if (vertex[2] > maxZ) maxZ = vertex[2];
100 max.
set(maxX, maxY, maxZ);
Axis aligned bounding box used for frustum, this is not directly connectable with physics engine.
BoundingBox()
Public constructor.
void fromBoundingVolume(BoundingBox *original)
Set up this bounding volume from given bounding volume.
void extend(BoundingBox *boundingBox)
Extend bounding box with given bounding box.
const vector< Vector3 > & getVertices() const
Returns bounding box vertices.
void fromBoundingVolumeWithTransformMatrix(BoundingBox *original, const Matrix4x4 &transformMatrix)
Create bounding volume from given original(of same type) with applied transform matrix.
void update()
Updates this bounding box.
vector< Vector3 > vertices
const Vector3 & getCenter() const
Oriented bounding box physics primitive.
const array< Vector3, 8 > getVertices() const
Matrix4x4 class representing matrix4x4 mathematical structure and operations for 3d space.
Vector3 multiply(const Vector3 &vector3) const
Multiplies this matrix with vector3.
Vector3 class representing vector3 mathematical structure and operations with x, y,...
Vector3 & add(float scalar)
Adds a scalar.
Vector3 & sub(float scalar)
Subtracts a scalar.
Vector3 & scale(float scalar)
Scales by scalar.
Vector3 & set(float x, float y, float z)
Sets this vector3 by its components.