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

Public Member Functions

 Interval (double min, double max)
 Construct a new Interval object.
 
 Interval (const Interval &a, const Interval &b)
 Construct a new Interval object.
 
double size () const
 Get the minimum value of the interval.
 
bool contains (double x) const
 Check if the interval contains the given value.
 
bool surrounds (double x) const
 Check if the interval surrounds the given value.
 
double clamp (double x) const
 Clamp the value to the interval.
 
Interval expand (double x) const
 Expand the interval by the given value.
 

Static Public Attributes

static const Interval Empty
 A constant empty interval.
 
static const Interval Universe
 A constant universe interval.
 

Constructor & Destructor Documentation

◆ Interval() [1/2]

Raytracer::Utils::Interval::Interval ( double min,
double max )

Construct a new Interval object.

This function constructs a new Interval object with the given minimum and maximum values.

Parameters
minThe minimum value.
maxThe maximum value.
Returns
A new Interval object.

◆ Interval() [2/2]

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

Construct a new Interval object.

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

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

Member Function Documentation

◆ clamp()

double Raytracer::Utils::Interval::clamp ( double x) const

Clamp the value to the interval.

This function clamps the value to the interval. The function returns the clamped value.

Parameters
xThe value to clamp.
Returns
The clamped value.

◆ contains()

bool Raytracer::Utils::Interval::contains ( double x) const

Check if the interval contains the given value.

This function checks if the interval contains the given value. The function returns true if the interval contains the value, false otherwise.

Parameters
xThe value to check.
Returns
True if the interval contains the value, false otherwise.

◆ expand()

Raytracer::Utils::Interval Raytracer::Utils::Interval::expand ( double x) const

Expand the interval by the given value.

This function expands the interval by the given value. The function returns the expanded interval.

Parameters
xThe value to expand the interval by.
Returns
The expanded interval.

◆ size()

double Raytracer::Utils::Interval::size ( ) const

Get the minimum value of the interval.

This function returns the minimum value of the interval.

Returns
The minimum value of the interval.

◆ surrounds()

bool Raytracer::Utils::Interval::surrounds ( double x) const

Check if the interval surrounds the given value.

This function checks if the interval surrounds the given value. The function returns true if the interval surrounds the value, false otherwise.

Parameters
xThe value to check.
Returns
True if the interval surrounds the value, false otherwise.

Member Data Documentation

◆ Empty

const Raytracer::Utils::Interval Raytracer::Utils::Interval::Empty
static
Initial value:
=
Interval(+std::numeric_limits<double>::infinity(),
-std::numeric_limits<double>::infinity())

A constant empty interval.

This constant represents an empty interval.

◆ Universe

const Raytracer::Utils::Interval Raytracer::Utils::Interval::Universe
static
Initial value:
=
Interval(-std::numeric_limits<double>::infinity(),
+std::numeric_limits<double>::infinity())

A constant universe interval.

This constant represents the universe interval.


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