#include <darts/box.h>
template<int N, typename T>
Box struct

An N-D axis-aligned bounding box consisting of two N-D points min and max.

Constructors, destructors, conversion operators

Box()
Create an empty box by default.
Box(const Vec<N, T>& p) explicit
Create a box containing a single point in space.
Box(const Vec<N, T>& p1, const Vec<N, T>& p2)
Create a box enclosing two points.

Public functions

auto volume() const -> T
Calculate the N-dimensional volume of the bounding box.
auto area() const -> T
Calculate the N-1 dimensional volume of the boundary.
auto intersect(const Ray<N, T>& ray) const -> bool
Check whether a Ray intersects this Box.

Public variables

Vec<N, T> min
The lower-bound of the interval.
Vec<N, T> max
The upper-bound of the interval.

Function documentation

template<int N, typename T>
bool Box<N, T>::intersect(const Ray<N, T>& ray) const

Check whether a Ray intersects this Box.

Parameters
ray The ray along which to check for intersection
Returns true if there is an intersection