TDME2 1.9.121
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OrientedBoundingBox.h
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4
5#include <tdme/tdme.h>
8#include <tdme/math/Vector3.h>
9
10using std::array;
11
15
16/**
17 * Oriented bounding box physics primitive
18 * @author Andreas Drewke
19 * @version $Id$
20 */
22 : public BoundingVolume
23{
24private:
25 STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE0_INDICES;
26 STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE1_INDICES;
27 STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE2_INDICES;
28 STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE3_INDICES;
29 STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE4_INDICES;
30 STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE5_INDICES;
31 STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE6_INDICES;
32 STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE7_INDICES;
33 STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE8_INDICES;
34 STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE9_INDICES;
35 STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE10_INDICES;
36 STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE11_INDICES;
37 STATIC_DLL_IMPEXT static const array<array<int32_t,3>,12> facesVerticesIndexes;
38
39public:
43
44public:
45 /**
46 * Public constructor
47 * @param center center
48 * @param axis0 axis0
49 * @param axis1 axis1
50 * @param axis2 axis2
51 * @param halfExtension half extension
52 * @param scale scale
53 */
54 OrientedBoundingBox(const Vector3& center, const Vector3& axis0, const Vector3& axis1, const Vector3& axis2, const Vector3& halfExtension, const Vector3& scale = Vector3(1.0f, 1.0f, 1.0f));
55
56 /**
57 * Public constructor
58 * @param bb bounding box
59 * @param scale scale
60 */
61 OrientedBoundingBox(BoundingBox* bb, const Vector3& scale = Vector3(1.0f, 1.0f, 1.0f));
62
63 /**
64 * Public constructor
65 */
67
68 /**
69 * @return 3 axes
70 */
71 const array<Vector3, 3>& getAxes() const;
72
73 /**
74 * @return half extension
75 */
76 const Vector3& getHalfExtension() const;
77
78 /**
79 * Set up oriented bounding box from oriented bounding box
80 * @param scale bb
81 */
82
83 // overrides
84 void setScale(const Vector3& scale) override;
85 BoundingVolume* clone() const override;
86
87 /**
88 * @return oriented bounding box vertices
89 */
90 const array<Vector3, 8> getVertices() const;
91
92 /**
93 * @return faces vertices indexes
94 */
95 static const array<array<int32_t,3>,12>& getFacesVerticesIndexes();
96
97private:
98 array<Vector3, 3> axes;
100};
Axis aligned bounding box used for frustum, this is not directly connectable with physics engine.
Definition: BoundingBox.h:25
Oriented bounding box physics primitive.
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE6_INDICES
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE1_INDICES
static STATIC_DLL_IMPEXT const array< array< int32_t, 3 >, 12 > facesVerticesIndexes
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE10_INDICES
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE5_INDICES
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE2_INDICES
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE11_INDICES
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE7_INDICES
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE9_INDICES
const array< Vector3, 8 > getVertices() const
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE4_INDICES
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE3_INDICES
void setScale(const Vector3 &scale) override
Set up oriented bounding box from oriented bounding box.
static STATIC_DLL_IMPEXT const Vector3 AABB_AXIS_Y
static const array< array< int32_t, 3 >, 12 > & getFacesVerticesIndexes()
const array< Vector3, 3 > & getAxes() const
BoundingVolume * clone() const override
Clones this bounding volume.
static STATIC_DLL_IMPEXT const Vector3 AABB_AXIS_Z
static STATIC_DLL_IMPEXT const Vector3 AABB_AXIS_X
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE0_INDICES
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE8_INDICES
3D vector 3 class
Definition: Vector3.h:22
#define STATIC_DLL_IMPEXT
Definition: tdme.h:11