Raytracer
Loading...
Searching...
No Matches
AxisAlignedBBox.hpp
1#include "core/Ray.hpp"
2#include "utils/Interval.hpp"
3#include "utils/VecN.hpp"
4
5#ifndef __AXIS_ALIGNED_BBOX_HPP__
6 #define __AXIS_ALIGNED_BBOX_HPP__
7
8namespace Raytracer::Utils
9{
11 private:
12 Interval _x;
13 Interval _y;
14 Interval _z;
15
16 public:
17 AxisAlignedBBox() = default;
19 const Interval &x, const Interval &y, const Interval &z);
20 AxisAlignedBBox(const Point3 &a, const Point3 &b);
22 const Interval &axisInterval(int n) const;
23 bool hit(const Core::Ray &ray, Interval interval) const;
24 int longestAxis() const;
25 void padToMinimum();
26 static const AxisAlignedBBox Empty;
28 GET_SET(Interval, x)
29 GET_SET(Interval, y)
30 GET_SET(Interval, z)
31 };
32
33 Utils::AxisAlignedBBox operator+(
34 const Utils::AxisAlignedBBox &value, Utils::Vec3 offset);
35 Utils::AxisAlignedBBox operator+(
36 Utils::Vec3 offset, const Utils::AxisAlignedBBox &value);
37} // namespace Raytracer::Utils
38
39#endif /* __AXIS_ALIGNED_BBOX_HPP__ */
Definition Ray.hpp:9
Definition AxisAlignedBBox.hpp:10
const Interval & axisInterval(int n) const
Get the interval along the x-axis.
Definition AxisAlignedBBox.cpp:77
static const AxisAlignedBBox Empty
Empty AxisAlignedBBox.
Definition AxisAlignedBBox.hpp:26
void padToMinimum()
Pad the AxisAlignedBBox to the minimum size.
Definition AxisAlignedBBox.cpp:160
static const AxisAlignedBBox Universe
Universe AxisAlignedBBox.
Definition AxisAlignedBBox.hpp:27
int longestAxis() const
Get the longest axis of the AxisAlignedBBox.
Definition AxisAlignedBBox.cpp:138
bool hit(const Core::Ray &ray, Interval interval) const
Check if the ray hits the AxisAlignedBBox.
Definition AxisAlignedBBox.cpp:100
Definition Interval.hpp:9
Definition VecN.hpp:40