Murl::Math::Box< DataType > Class Template Reference

A box class describing the minimum and maximum coordinate of a 3d-box. More...

#include "murl_math_box.h"

Public Types

using ValueType = DataType
 The template parameter value type.
 

Public Member Functions

 Box ()
 The default constructor.
 
 Box (const Box &b1, const Box &b2)
 Constructor uniting two given boxes. More...
 
 Box (const Vector< DataType > &point)
 Constructor taking a single coordinate. More...
 
 Box (const Vector< DataType > &min, const Vector< DataType > &max)
 Constructor taking minimum and maximum coordinates. More...
 
 Box (const Vector< DataType > &a, const Vector< DataType > &b, const Vector< DataType > &c)
 Constructor taking the three points of a triangle. More...
 
 Box (const Sphere< DataType > &sphere)
 Constructor taking a sphere. More...
 
template<class DataType2 >
 Box (const Box< DataType2 > &b)
 The copy constructor using a box of different type. More...
 
void Clear ()
 Clear the box.
 
void Set (const Box &other)
 Set the coordinates from a box. More...
 
void Set (const Box &b1, const Box &b2)
 Set the coordinates by uniting two given boxes. More...
 
void Set (const Vector< DataType > &point)
 Set the coordinates to a single coordinate. More...
 
void Set (const Vector< DataType > &min, const Vector< DataType > &max)
 Set the minimum and maximum coordinates. More...
 
void Set (const Vector< DataType > &a, const Vector< DataType > &b, const Vector< DataType > &c)
 Set the coordinates by the three points of a triangle. More...
 
void Set (const Sphere< DataType > &sphere)
 Set the coordinates by a sphere. More...
 
void SetMinimum (const Vector< DataType > &min)
 Set the minimum coordinate. More...
 
void SetMaximum (const Vector< DataType > &max)
 Set the maximum coordinate. More...
 
const Vector< DataType > & GetMinimum () const
 Get the minimum coordinate. More...
 
const Vector< DataType > & GetMaximum () const
 Get the maximum coordinate. More...
 
void Unite (const Box &other)
 Unite this box with another box. More...
 
void Include (const Vector< DataType > &point)
 Include a point in this box. More...
 
Bool IsIntersecting (const Box &other) const
 Check if a given box is intersecting this box. More...
 
Bool IsEmpty () const
 Check if a the box is empty. More...
 
UInt32 GetFlags () const
 Get the flags. More...
 
String ToString () const
 Get the string representation of the object. More...
 

Protected Attributes

Vector< DataType > mMin
 The minimum position.
 
Vector< DataType > mMax
 The maximum position.
 
UInt32 mFlags
 Box flags.
 

Detailed Description

template<class DataType>
class Murl::Math::Box< DataType >

A box class describing the minimum and maximum coordinate of a 3d-box.

Constructor & Destructor Documentation

◆ Box() [1/6]

template<class DataType >
Murl::Math::Box< DataType >::Box ( const Box< DataType > &  b1,
const Box< DataType > &  b2 
)
inline

Constructor uniting two given boxes.

Parameters
b1The first box.
b2The second box.

References Murl::Math::Box< DataType >::Unite().

◆ Box() [2/6]

template<class DataType >
Murl::Math::Box< DataType >::Box ( const Vector< DataType > &  point)
inline

Constructor taking a single coordinate.

Parameters
pointThe coordinate for minimum and maximum.

◆ Box() [3/6]

template<class DataType >
Murl::Math::Box< DataType >::Box ( const Vector< DataType > &  min,
const Vector< DataType > &  max 
)
inline

Constructor taking minimum and maximum coordinates.

Parameters
minThe minimum coordinate.
maxThe maximum coordinate.

◆ Box() [4/6]

template<class DataType >
Murl::Math::Box< DataType >::Box ( const Vector< DataType > &  a,
const Vector< DataType > &  b,
const Vector< DataType > &  c 
)
inline

Constructor taking the three points of a triangle.

Parameters
aThe first triangle coordinate.
bThe second triangle coordinate.
cThe third triangle coordinate.

References Murl::Math::Box< DataType >::Set().

◆ Box() [5/6]

template<class DataType >
Murl::Math::Box< DataType >::Box ( const Sphere< DataType > &  sphere)
inline

Constructor taking a sphere.

The box is only approximated and slightly larger than it needs to be.

Parameters
sphereThe sphere to enclose.

References Murl::Math::Box< DataType >::Set().

◆ Box() [6/6]

template<class DataType >
template<class DataType2 >
Murl::Math::Box< DataType >::Box ( const Box< DataType2 > &  b)
inline

The copy constructor using a box of different type.

Parameters
bThe box to copy.

Member Function Documentation

◆ Set() [1/6]

template<class DataType >
void Murl::Math::Box< DataType >::Set ( const Box< DataType > &  other)
inline

Set the coordinates from a box.

Parameters
otherThe box to copy from.

References Murl::Math::Box< DataType >::mFlags, Murl::Math::Box< DataType >::mMax, and Murl::Math::Box< DataType >::mMin.

Referenced by Murl::Math::Box< DataType >::Box(), and Murl::Math::Box< DataType >::Unite().

◆ Set() [2/6]

template<class DataType >
void Murl::Math::Box< DataType >::Set ( const Box< DataType > &  b1,
const Box< DataType > &  b2 
)
inline

Set the coordinates by uniting two given boxes.

Parameters
b1The first box.
b2The second box.

References Murl::Math::Box< DataType >::mFlags, Murl::Math::Box< DataType >::mMax, Murl::Math::Box< DataType >::mMin, and Murl::Math::Box< DataType >::Unite().

◆ Set() [3/6]

template<class DataType >
void Murl::Math::Box< DataType >::Set ( const Vector< DataType > &  point)
inline

◆ Set() [4/6]

template<class DataType >
void Murl::Math::Box< DataType >::Set ( const Vector< DataType > &  min,
const Vector< DataType > &  max 
)
inline

Set the minimum and maximum coordinates.

Parameters
minThe minimum coordinate.
maxThe maximum coordinate.

References Murl::Math::Box< DataType >::mFlags, Murl::Math::Box< DataType >::mMax, Murl::Math::Box< DataType >::mMin, Murl::Math::Vector< DataType >::x, Murl::Math::Vector< DataType >::y, and Murl::Math::Vector< DataType >::z.

◆ Set() [5/6]

template<class DataType >
void Murl::Math::Box< DataType >::Set ( const Vector< DataType > &  a,
const Vector< DataType > &  b,
const Vector< DataType > &  c 
)
inline

Set the coordinates by the three points of a triangle.

Parameters
aThe first triangle coordinate.
bThe second triangle coordinate.
cThe third triangle coordinate.

References Murl::Math::Vector< DataType >::Max(), Murl::Math::Box< DataType >::mFlags, Murl::Math::Vector< DataType >::Min(), Murl::Math::Box< DataType >::mMax, and Murl::Math::Box< DataType >::mMin.

◆ Set() [6/6]

template<class DataType >
void Murl::Math::Box< DataType >::Set ( const Sphere< DataType > &  sphere)
inline

◆ SetMinimum()

template<class DataType >
void Murl::Math::Box< DataType >::SetMinimum ( const Vector< DataType > &  min)
inline

Set the minimum coordinate.

Parameters
minThe minimum coordinate.

References Murl::Math::Box< DataType >::mFlags, and Murl::Math::Box< DataType >::mMin.

◆ SetMaximum()

template<class DataType >
void Murl::Math::Box< DataType >::SetMaximum ( const Vector< DataType > &  max)
inline

Set the maximum coordinate.

Parameters
maxThe maximum coordinate.

References Murl::Math::Box< DataType >::mFlags, and Murl::Math::Box< DataType >::mMax.

◆ GetMinimum()

◆ GetMaximum()

◆ Unite()

template<class DataType >
void Murl::Math::Box< DataType >::Unite ( const Box< DataType > &  other)
inline

◆ Include()

template<class DataType >
void Murl::Math::Box< DataType >::Include ( const Vector< DataType > &  point)
inline

Include a point in this box.

Parameters
pointThe point to include.

References Murl::Math::Box< DataType >::mFlags, Murl::Math::Box< DataType >::mMax, and Murl::Math::Box< DataType >::mMin.

Referenced by Murl::Math::Sphere< DataType >::SetBounding().

◆ IsIntersecting()

template<class DataType >
Bool Murl::Math::Box< DataType >::IsIntersecting ( const Box< DataType > &  other) const
inline

Check if a given box is intersecting this box.

Parameters
otherThe other box to check.
Returns
true if the other box is intersecting this box.

References Murl::Math::Box< DataType >::mMax, and Murl::Math::Box< DataType >::mMin.

◆ IsEmpty()

template<class DataType >
Bool Murl::Math::Box< DataType >::IsEmpty ( ) const
inline

Check if a the box is empty.

A box is only empty when created with the default constructor, explicitly cleared by calling Clear(), or duplicated from another empty box or sphere. As soon as a single point is included, the box is considered "not empty".

Returns
true if the box is empty.

References Murl::Math::Box< DataType >::mFlags.

Referenced by Murl::Math::Sphere< DataType >::Set(), and Murl::Math::Box< DataType >::Unite().

◆ GetFlags()

template<class DataType >
UInt32 Murl::Math::Box< DataType >::GetFlags ( ) const
inline

Get the flags.

Returns
The bit-mask of flags.

References Murl::Math::Box< DataType >::mFlags.

◆ ToString()

template<class DataType >
String Murl::Math::Box< DataType >::ToString ( ) const
inline

Get the string representation of the object.

Returns
The string representation of the object.

References Murl::Math::Box< DataType >::mMax, and Murl::Math::Box< DataType >::mMin.


The documentation for this class was generated from the following files:
  • murl_graph_types.h
  • murl_math_box.h


Copyright © 2011-2024 Spraylight GmbH.