bbox.h

changeset 121
7e87c85ad092
parent 104
6e29bb0e83c5
child 135
c243df39913e
equal deleted inserted replaced
120:607301744394 121:7e87c85ad092
18 18
19 #ifndef __BBOX_H__ 19 #ifndef __BBOX_H__
20 #define __BBOX_H__ 20 #define __BBOX_H__
21 21
22 #include "common.h" 22 #include "common.h"
23 #include "types.h"
23 24
24 // ============================================================================= 25 // =============================================================================
25 // The bounding box, bbox for short, is the 26 // bbox
26 // box that encompasses the model we have open. 27 //
28 // The bounding box is the box that encompasses a given set of objects. The
29 // global instance g_BBox is the bbox for the model we have open.
27 // v0 is the minimum vertex, v1 is the maximum vertex. 30 // v0 is the minimum vertex, v1 is the maximum vertex.
28 // =============================================================================
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
30 // ============================================================================= 31 // =============================================================================
31 class bbox { 32 class bbox {
32 public: 33 public:
33 vertex v0, v1; 34 vertex v0, v1;
34 35
35 bbox (); 36 bbox ();
36 37
37 void reset (); 38 void reset ();
38 void calculate (); 39 void calculate ();
39 double calcSize (); 40 double size () const;
41 void calcObject (LDObject* obj);
42 void calcVertex (vertex v);
43 vertex center () const;
40 44
41 private: 45 bbox& operator<< (LDObject* obj) {
42 void checkObject (LDObject* obj); 46 calcObject (obj);
43 void checkVertex (vertex v); 47 return *this;
48 }
49
50 bbox& operator<< (vertex& v) {
51 calcVertex (v);
52 return *this;
53 }
44 }; 54 };
45 55
46 #endif 56 #endif

mercurial