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__
Point mCenter
B for Box.
Definition: IceOBB.h:169
inline_ ~OBB()
Destructor.
Definition: IceOBB.h:26
Point mExtents
B for Bounding.
Definition: IceOBB.h:170
#define FALSE
Definition: OPC_IceHook.h:9
inline_ const Matrix3x3 & GetRot() const
Definition: IceOBB.h:161
inline_ const Point & GetExtents() const
Definition: IceOBB.h:160
#define TRUE
Definition: OPC_IceHook.h:13
#define inline_
inline_ void Scale(const Point &p)
Scales from a Point. Each row is multiplied by a component.
Definition: IceMatrix3x3.h:52
Definition: IcePoint.h:25
#define ICEMATHS_API
Definition: OPC_IceHook.h:51
Definition: IcePlane.h:17
inline_ const Point & GetCenter() const
Definition: IceOBB.h:159
inline_ OBB(const Point &center, const Point &extents, const Matrix3x3 &rot)
Constructor.
Definition: IceOBB.h:24
int BOOL
Another boolean type.
Definition: IceTypes.h:102
unsigned int udword
sizeof(udword) must be 4
Definition: IceTypes.h:65
inline_ OBB()
Constructor.
Definition: IceOBB.h:22
RTObject_impl * Create(Manager *manager)
Definition: IceAABB.h:267
Definition: IceOBB.h:18
inline_ void GetRotatedExtents(Matrix3x3 &extents) const
Definition: IceOBB.h:163
Matrix3x3 mRot
O for Oriented.
Definition: IceOBB.h:171
#define MIN_FLOAT
min possible loat value
Definition: IceTypes.h:131
Definition: jquant2.c:258
Definition: IceLSS.h:15


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat Apr 13 2019 02:14:22