IceOBB.h
Go to the documentation of this file.
1 
8 
11 // Include Guard
12 #ifndef __ICEOBB_H__
13 #define __ICEOBB_H__
14 
15  // Forward declarations
16  class LSS;
17 
19  {
20  public:
22  inline_ OBB() {}
24  inline_ OBB(const Point& center, const Point& extents, const Matrix3x3& rot) : mCenter(center), mExtents(extents), mRot(rot) {}
27 
29 
32  void SetEmpty()
34  {
35  mCenter.Zero();
36  mExtents.Set(MIN_FLOAT, MIN_FLOAT, MIN_FLOAT);
37  mRot.Identity();
38  }
39 
41 
46  bool ContainsPoint(const Point& p) const;
48 
50 
55  void Create(const AABB& aabb, const Matrix4x4& mat);
57 
59 
64  inline_ void Rotate(const Matrix4x4& mtx, OBB& obb) const
66  {
67  // The extents remain constant
68  obb.mExtents = mExtents;
69  // The center gets x-formed
70  obb.mCenter = mCenter * mtx;
71  // Combine rotations
72  obb.mRot = mRot * Matrix3x3(mtx);
73  }
74 
76 
80  inline_ BOOL IsValid() const
82  {
83  // Consistency condition for (Center, Extents) boxes: Extents >= 0.0f
84  if(mExtents.x < 0.0f) return FALSE;
85  if(mExtents.y < 0.0f) return FALSE;
86  if(mExtents.z < 0.0f) return FALSE;
87  return TRUE;
88  }
89 
91 
96  bool ComputePlanes(Plane* planes) const;
98 
100 
105  bool ComputePoints(Point* pts) const;
107 
109 
114  bool ComputeVertexNormals(Point* pts) const;
116 
118 
122  const udword* GetEdges() const;
124 
126 
130  const Point* GetLocalEdgeNormals() const;
132 
134 
139  void ComputeWorldEdgeNormal(udword edge_index, Point& world_normal) const;
141 
143 
147  void ComputeLSS(LSS& lss) const;
149 
151 
156  BOOL IsInside(const OBB& box) const;
158 
159  inline_ const Point& GetCenter() const { return mCenter; }
160  inline_ const Point& GetExtents() const { return mExtents; }
161  inline_ const Matrix3x3& GetRot() const { return mRot; }
162 
163  inline_ void GetRotatedExtents(Matrix3x3& extents) const
164  {
165  extents = mRot;
166  extents.Scale(mExtents);
167  }
168 
172 
173  // Orientation is stored in row-major format,
174  // i.e. rows = eigen vectors of the covariance matrix
175  };
176 
177 #endif // __ICEOBB_H__
OBB::OBB
inline_ OBB(const Point &center, const Point &extents, const Matrix3x3 &rot)
Constructor.
Definition: IceOBB.h:24
MIN_FLOAT
#define MIN_FLOAT
min possible loat value
Definition: IceTypes.h:131
Matrix4x4
Definition: IceMatrix4x4.h:21
LSS
Definition: IceLSS.h:15
Matrix3x3::Scale
inline_ void Scale(const Point &p)
Scales from a Point. Each row is multiplied by a component.
Definition: IceMatrix3x3.h:52
box
Definition: jquant2.c:258
udword
unsigned int udword
sizeof(udword) must be 4
Definition: IceTypes.h:65
BOOL
int BOOL
Another boolean type.
Definition: IceTypes.h:102
OBB::GetExtents
const inline_ Point & GetExtents() const
Definition: IceOBB.h:160
OBB::mRot
Matrix3x3 mRot
O for Oriented.
Definition: IceOBB.h:171
OBB::mCenter
Point mCenter
B for Box.
Definition: IceOBB.h:169
OBB::GetCenter
const inline_ Point & GetCenter() const
Definition: IceOBB.h:159
OBB::GetRot
const inline_ Matrix3x3 & GetRot() const
Definition: IceOBB.h:161
OBB::mExtents
Point mExtents
B for Bounding.
Definition: IceOBB.h:170
TRUE
#define TRUE
Definition: OPC_IceHook.h:13
OBB
Definition: IceOBB.h:18
OBB::OBB
inline_ OBB()
Constructor.
Definition: IceOBB.h:22
ICEMATHS_API
#define ICEMATHS_API
Definition: OPC_IceHook.h:51
FALSE
#define FALSE
Definition: OPC_IceHook.h:9
OBB::~OBB
inline_ ~OBB()
Destructor.
Definition: IceOBB.h:26
Point
Definition: IcePoint.h:25
Plane
Definition: IcePlane.h:17
OBB::GetRotatedExtents
inline_ void GetRotatedExtents(Matrix3x3 &extents) const
Definition: IceOBB.h:163
Matrix3x3
Definition: IceMatrix3x3.h:20
inline_
#define inline_
Definition: IcePreprocessor.h:103
AABB
Definition: IceAABB.h:267


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Wed Sep 7 2022 02:51:03