code for assignment 4, gitignored *.ppm, *.png
[MicroTrace.git] / Box.hxx
diff --git a/Box.hxx b/Box.hxx
new file mode 100644 (file)
index 0000000..1417e80
--- /dev/null
+++ b/Box.hxx
@@ -0,0 +1,33 @@
+#ifndef BOX_HXX
+#define BOX_HXX
+
+#include "Ray.hxx"
+
+class Box
+{
+public:
+  Box();
+  ~Box();
+
+  Box(const Box& b);
+  Box& operator=(const Box& b);
+  
+  //! Extend the bounding box to contain point a
+  void Extend(const Vec3f& a);
+  //! Clear the bounding box, i.e. set dimensions to infinity.
+  void Clear();
+  //! Extend the box to contain the given box.
+  void Extend(const Box& box);
+  //! Test for overlap with the given box b.
+  bool Overlaps(const Box& b) const;
+  //! Clip the given ray against the box. tnear and tfar should be filled by this function!
+  void Clip(const Ray& ray, float& tnear,float& tfar) const;
+
+  //! Query the dimension of the bounding box.
+  const Vec3f& min() const;
+  const Vec3f& max() const;
+private:
+  Vec3f m_min, m_max;
+};
+
+#endif
This page took 0.027414 seconds and 4 git commands to generate.