added: travMask to csm viewport
[opensg.git] / Source / Base / Base / OSGBoxVolume.inl
blobd98d45c97270d659b5ea71cff5a1f9d2166f2c6c
1 /*---------------------------------------------------------------------------*\
2  *                                OpenSG                                     *
3  *                                                                           *
4  *                                                                           *
5  *                         Copyright 2000 by OpenSG Forum                    *
6  *                                                                           *
7  *          contact: {reiners|vossg}@igd.fhg.de, jbehr@zgdv.de               *
8  *                                                                           *
9 \*---------------------------------------------------------------------------*/
10 /*---------------------------------------------------------------------------*\
11  *                                License                                    *
12  *                                                                           *
13  *                                                                           *
14  *                                                                           *
15  *                                                                           *
16  *                                                                           *
17 \*---------------------------------------------------------------------------*/
18 /*---------------------------------------------------------------------------*\
19  *                                Changes                                    *
20  *                                                                           *
21  *                                                                           *
22  *                                                                           *
23  *                                                                           *
24  *                                                                           *
25  *                                                                           *
26 \*---------------------------------------------------------------------------*/
28 #ifndef _OSGBOXVOLUME_INL_
29 #define _OSGBOXVOLUME_INL_
31 OSG_BEGIN_NAMESPACE
33 /*! Default constructor - leaves box totally empty
36 inline
37 BoxVolume::BoxVolume(void) : 
38      Inherited(             ),
39     _min      (0.f, 0.f, 0.f), 
40     _max      (0.f, 0.f, 0.f)
45 inline
46 BoxVolume::BoxVolume(Real32 xmin, Real32 ymin, Real32 zmin,
47                      Real32 xmax, Real32 ymax, Real32 zmax) :
48      Inherited(                ), 
49     _min      (xmin, ymin, zmin), 
50     _max      (xmax, ymax, zmax)
51
52     setEmpty(false);
56 inline
57 BoxVolume::BoxVolume(const Pnt3f &min, const Pnt3f &max) :
58      Inherited(   ), 
59     _min      (min), 
60     _max      (max)
61
62     setEmpty(false); 
66 inline
67 BoxVolume::BoxVolume(const BoxVolume &obj) :
68      Inherited(obj     ), 
69     _min      (obj._min), 
70     _max      (obj._max) 
75 inline
76 BoxVolume::~BoxVolume(void) 
81 inline
82 const Pnt3f &BoxVolume::getMin(void) const
84     return _min;
88 inline
89 const Pnt3f &BoxVolume::getMax(void) const
91     return _max;
95 inline
96 void BoxVolume::getBounds(Real32 &xmin, 
97                           Real32 &ymin, 
98                           Real32 &zmin,
99                           Real32 &xmax, 
100                           Real32 &ymax, 
101                           Real32 &zmax) const
103     _min.getSeparateValues(xmin, ymin, zmin);
104     _max.getSeparateValues(xmax, ymax, zmax);
108 inline
109 void BoxVolume::getOrigin(Real32 &originX, 
110                           Real32 &originY, 
111                           Real32 &originZ) const
113     originX = _min[0];
114     originY = _min[1];
115     originZ = _min[2];
119 inline
120 void BoxVolume::getSize(Real32 &sizeX, 
121                         Real32 &sizeY, 
122                         Real32 &sizeZ) const
124     sizeX = _max[0] - _min[0];
125     sizeY = _max[1] - _min[1];
126     sizeZ = _max[2] - _min[2];
130 inline
131 void BoxVolume::getSize(Vec3f &vec) const
133     vec.setValues(_max[0] - _min[0], _max[1] - _min[1], _max[2] - _min[2]);
137 inline
138 void BoxVolume::setBounds(Real32 w, Real32 h, Real32 d)
140     _min.setValues(-w / 2.0f, -h / 2.0f, -d / 2.0f);
141     _max.setValues( w / 2.0f,  h / 2.0f,  d / 2.0f);
143     Volume::setValid   (true );
144     Volume::setEmpty   (false);
145     Volume::setInfinite(false);
149 inline
150 void BoxVolume::setBounds(Real32 xmin, 
151                           Real32 ymin, 
152                           Real32 zmin,
153                           Real32 xmax, 
154                           Real32 ymax, 
155                           Real32 zmax)
157     _min.setValues(xmin, ymin, zmin);
158     _max.setValues(xmax, ymax, zmax);
160     Volume::setValid   (true );
161     Volume::setEmpty   (false);
162     Volume::setInfinite(false);
166 inline
167 void BoxVolume::setBounds(const Pnt3f &min, const Pnt3f &max)
169     _min = min; 
170     _max = max;
172     Volume::setValid   (true );
173     Volume::setEmpty   (false);
174     Volume::setInfinite(false);
177 inline
178 Pnt3f &BoxVolume::editMin(void)
180     return _min;
184 inline
185 Pnt3f &BoxVolume::editMax(void)
187     return _max;
190 inline
191 void BoxVolume::extendBy(const BoxVolume &volume)
193     OSG::extend(*this, volume);
197 inline
198 bool BoxVolume::operator !=(const BoxVolume &rhs) const
200     return !(*this == rhs);
203 OSG_END_NAMESPACE
205 #endif // _OSG_BOXVOLUME_INL_