Choreonoid  1.5
BoundingBox.h
Go to the documentation of this file.
1 
6 #ifndef CNOID_UTIL_BOUNDING_BOX_H
7 #define CNOID_UTIL_BOUNDING_BOX_H
8 
9 #include "EigenTypes.h"
10 #include <iosfwd>
11 #include "exportdecl.h"
12 
13 namespace cnoid {
14 
15 class BoundingBoxf;
16 
18 {
19 public:
20  BoundingBox();
21  BoundingBox(const Vector3& min, const Vector3& max);
22  BoundingBox(const BoundingBox& org);
23  BoundingBox(const BoundingBoxf& org);
24 
25  void set(const Vector3& min, const Vector3& max);
26  void clear();
27 
28  bool empty() const { return empty_; }
29  const Vector3& min() const { return min_; }
30  const Vector3& max() const { return max_; }
31  Vector3 center() const;
32  Vector3 size() const;
33  double boundingSphereRadius() const;
34 
35  void expandBy(const BoundingBox& bbox);
36  void expandBy(double x, double y, double z);
37  void expandBy(const Vector3& v){ expandBy(v.x(), v.y(), v.z()); }
38 
39  void transform(const Affine3& T);
40 
41 private:
42  Vector3 min_;
43  Vector3 max_;
44  bool empty_;
45 };
46 
47 CNOID_EXPORT std::ostream& operator<<(std::ostream& os, const BoundingBox& bb);
48 
53 {
54 public:
55  BoundingBoxf();
56  BoundingBoxf(const Vector3f& min, const Vector3f& max);
57  BoundingBoxf(const BoundingBoxf& org);
58  BoundingBoxf(const BoundingBox& org);
59 
60  void set(const Vector3f& min, const Vector3f& max);
61  void clear();
62 
63  bool empty() const { return empty_; }
64  const Vector3f& min() const { return min_; }
65  const Vector3f& max() const { return max_; }
66  Vector3f center() const;
67  float boundingSphereRadius() const;
68 
69  void expandBy(const BoundingBoxf& bbox);
70  void expandBy(float x, float y, float z);
71  void expandBy(const Vector3f& v){ expandBy(v.x(), v.y(), v.z()); }
72 
73  void transform(const Affine3f& T);
74 
75 private:
76  bool empty_;
77  Vector3f min_;
78  Vector3f max_;
79 };
80 
81 CNOID_EXPORT std::ostream& operator<<(std::ostream& os, const BoundingBoxf& bb);
82 
83 }
84 
85 #endif
CNOID_EXPORT std::ostream & operator<<(std::ostream &os, const BoundingBox &bb)
Definition: BoundingBox.cpp:153
Eigen::Affine3d Affine3
Definition: EigenTypes.h:64
const Vector3 & min() const
Definition: BoundingBox.h:29
Definition: BoundingBox.h:17
void expandBy(const Vector3 &v)
Definition: BoundingBox.h:37
const Vector3f & min() const
Definition: BoundingBox.h:64
bool empty() const
Definition: BoundingBox.h:28
bool empty() const
Definition: BoundingBox.h:63
Defines the minimum processing for performing pasing file for STL.
Definition: AbstractSceneLoader.h:9
Definition: BoundingBox.h:52
const Vector3f & max() const
Definition: BoundingBox.h:65
Eigen::Vector3d Vector3
Definition: EigenTypes.h:58
#define CNOID_EXPORT
Definition: Util/exportdecl.h:37
const Vector3 & max() const
Definition: BoundingBox.h:30
void expandBy(const Vector3f &v)
Definition: BoundingBox.h:71