bbox.h

changeset 164
8c93d8e38494
parent 135
c243df39913e
equal deleted inserted replaced
163:46955613626d 164:8c93d8e38494
29 // global instance g_BBox is the bbox for the model we have open. 29 // global instance g_BBox is the bbox for the model we have open.
30 // v0 is the minimum vertex, v1 is the maximum vertex. 30 // v0 is the minimum vertex, v1 is the maximum vertex.
31 // ============================================================================= 31 // =============================================================================
32 class bbox { 32 class bbox {
33 public: 33 public:
34 vertex v0, v1;
35
36 bbox (); 34 bbox ();
37
38 void reset (); 35 void reset ();
39 void calculate (); 36 void calculate ();
40 double size () const; 37 double size () const;
41 void calcObject (LDObject* obj); 38 void calcObject (LDObject* obj);
42 void calcVertex (vertex v); 39 void calcVertex (vertex v);
43 vertex center () const; 40 vertex center () const;
41 bool empty () const;
44 42
45 bbox& operator<< (LDObject* obj) { 43 bbox& operator<< (LDObject* obj) {
46 calcObject (obj); 44 calcObject (obj);
47 return *this; 45 return *this;
48 } 46 }
49 47
50 bbox& operator<< (vertex& v) { 48 bbox& operator<< (vertex& v) {
51 calcVertex (v); 49 calcVertex (v);
52 return *this; 50 return *this;
53 } 51 }
52
53 const vertex& v0 () { return m_v0; }
54 const vertex& v1 () { return m_v1; }
55
56 private:
57 vertex m_v0, m_v1;
58 bool m_empty;
54 }; 59 };
55 60
56 #endif // BBOX_H 61 #endif // BBOX_H

mercurial