Raytracer
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
Raytracer::Utils::AxisAlignedBBox Class Reference

Public Member Functions

 AxisAlignedBBox (const Interval &x, const Interval &y, const Interval &z)
 Construct a new AxisAlignedBBox object.
 
 AxisAlignedBBox (const Point3 &a, const Point3 &b)
 Construct a new AxisAlignedBBox object.
 
 AxisAlignedBBox (const AxisAlignedBBox &a, const AxisAlignedBBox &b)
 Construct a new AxisAlignedBBox object.
 
const IntervalaxisInterval (int n) const
 Get the interval along the x-axis.
 
bool hit (const Core::Ray &ray, Interval interval) const
 Check if the ray hits the AxisAlignedBBox.
 
int longestAxis () const
 Get the longest axis of the AxisAlignedBBox.
 
void padToMinimum ()
 Pad the AxisAlignedBBox to the minimum size.
 

Static Public Attributes

static const AxisAlignedBBox Empty
 Empty AxisAlignedBBox.
 
static const AxisAlignedBBox Universe
 Universe AxisAlignedBBox.
 

Constructor & Destructor Documentation

◆ AxisAlignedBBox() [1/3]

Raytracer::Utils::AxisAlignedBBox::AxisAlignedBBox ( const Interval & x,
const Interval & y,
const Interval & z )

Construct a new AxisAlignedBBox object.

This function constructs a new AxisAlignedBBox object with the given x, y, and z intervals. The AxisAlignedBBox is an axis-aligned bounding box that represents a box in 3D space. The x, y, and z intervals represent the intervals of the box along the x, y, and z axes.

Parameters
xThe interval along the x-axis.
yThe interval along the y-axis.
zThe interval along the z-axis.
Returns
A new AxisAlignedBBox object.

◆ AxisAlignedBBox() [2/3]

Raytracer::Utils::AxisAlignedBBox::AxisAlignedBBox ( const Point3 & a,
const Point3 & b )

Construct a new AxisAlignedBBox object.

This function constructs a new AxisAlignedBBox object with the given points. The AxisAlignedBBox is an axis-aligned bounding box that represents a box in 3D space. The box is defined by the two points.

Parameters
aThe first point of the box.
bThe second point of the box.
Returns
A new AxisAlignedBBox object.

◆ AxisAlignedBBox() [3/3]

Raytracer::Utils::AxisAlignedBBox::AxisAlignedBBox ( const AxisAlignedBBox & a,
const AxisAlignedBBox & b )

Construct a new AxisAlignedBBox object.

This function constructs a new AxisAlignedBBox object by combining the given AxisAlignedBBoxes. The new AxisAlignedBBox is the smallest AxisAlignedBBox that contains both of the given AxisAlignedBBoxes.

Parameters
aThe first AxisAlignedBBox.
bThe second AxisAlignedBBox.
Returns
A new AxisAlignedBBox object.

Member Function Documentation

◆ axisInterval()

const Raytracer::Utils::Interval & Raytracer::Utils::AxisAlignedBBox::axisInterval ( int n) const

Get the interval along the x-axis.

This function returns the interval along the x-axis.

Parameters
nThe axis to get the interval for.
Returns
The interval along the x-axis.

◆ hit()

bool Raytracer::Utils::AxisAlignedBBox::hit ( const Core::Ray & ray,
Interval interval ) const

Check if the ray hits the AxisAlignedBBox.

This function checks if the ray hits the AxisAlignedBBox. The function returns true if the ray hits the AxisAlignedBBox. The function returns false if the ray does not hit the AxisAlignedBBox.

Parameters
rayThe ray to check for hits.
intervalThe interval to check for hits.
Returns
True if the ray hits the AxisAlignedBBox, false otherwise.

◆ longestAxis()

int Raytracer::Utils::AxisAlignedBBox::longestAxis ( ) const

Get the longest axis of the AxisAlignedBBox.

This function returns the index of the longest axis of the AxisAlignedBBox. The function returns 0 if the x-axis is the longest axis. The function returns 1 if the y-axis is the longest axis. The function returns 2 if the z-axis is the longest axis.

Returns
The index of the longest axis of the AxisAlignedBBox.

◆ padToMinimum()

void Raytracer::Utils::AxisAlignedBBox::padToMinimum ( )

Pad the AxisAlignedBBox to the minimum size.

This function pads the AxisAlignedBBox to the minimum size. The function expands the intervals of the AxisAlignedBBox to the minimum size if the intervals are smaller than the minimum size.

Returns
void

Member Data Documentation

◆ Empty

const Raytracer::Utils::AxisAlignedBBox Raytracer::Utils::AxisAlignedBBox::Empty
static
Initial value:
=
static const Interval Empty
A constant empty interval.
Definition Interval.hpp:23

Empty AxisAlignedBBox.

This constant represents an empty AxisAlignedBBox.

◆ Universe

const Raytracer::Utils::AxisAlignedBBox Raytracer::Utils::AxisAlignedBBox::Universe
static
Initial value:
= AxisAlignedBBox(
static const Interval Universe
A constant universe interval.
Definition Interval.hpp:24

Universe AxisAlignedBBox.

This constant represents the universe AxisAlignedBBox.


The documentation for this class was generated from the following files: