box overlapping
[MicroTrace.git] / Box.hxx
1 #ifndef BOX_HXX
2 #define BOX_HXX
3
4 #include "Ray.hxx"
5
6 class Box
7 {
8 public:
9 Box();
10 Box(Vec3f min, Vec3f max);
11 ~Box();
12
13 Box(const Box& b);
14 Box& operator=(const Box& b);
15
16 //! Extend the bounding box to contain point a
17 void Extend(const Vec3f& a);
18 //! Clear the bounding box, i.e. set dimensions to infinity.
19 void Clear();
20 //! Extend the box to contain the given box.
21 void Extend(const Box& box);
22 //! Test for overlap with the given box b.
23 bool Overlaps(const Box& b) const;
24 //! Clip the given ray against the box. tnear and tfar should be filled by this function!
25 void Clip(const Ray& ray, float& tnear,float& tfar) const;
26
27 //! Query the dimension of the bounding box.
28 const Vec3f& min() const;
29 const Vec3f& max() const;
30 private:
31 Vec3f m_min, m_max;
32 bool OverlapsHelper(Box b) const;
33 };
34
35 #endif
This page took 0.053349 seconds and 5 git commands to generate.