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]
|
inline |
Constructor uniting two given boxes.
- Parameters
-
b1 The first box. b2 The second box.
References Murl::Math::Box< DataType >::Unite().
◆ Box() [2/6]
|
inline |
Constructor taking a single coordinate.
- Parameters
-
point The coordinate for minimum and maximum.
◆ Box() [3/6]
|
inline |
Constructor taking minimum and maximum coordinates.
- Parameters
-
min The minimum coordinate. max The maximum coordinate.
◆ Box() [4/6]
|
inline |
Constructor taking the three points of a triangle.
- Parameters
-
a The first triangle coordinate. b The second triangle coordinate. c The third triangle coordinate.
References Murl::Math::Box< DataType >::Set().
◆ Box() [5/6]
|
inline |
Constructor taking a sphere.
The box is only approximated and slightly larger than it needs to be.
- Parameters
-
sphere The sphere to enclose.
References Murl::Math::Box< DataType >::Set().
◆ Box() [6/6]
|
inline |
The copy constructor using a box of different type.
- Parameters
-
b The box to copy.
Member Function Documentation
◆ Set() [1/6]
|
inline |
Set the coordinates from a box.
- Parameters
-
other The 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]
|
inline |
Set the coordinates by uniting two given boxes.
- Parameters
-
b1 The first box. b2 The 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]
|
inline |
Set the coordinates to a single coordinate.
- Parameters
-
point The coordinate for minimum and maximum.
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() [4/6]
|
inline |
Set the minimum and maximum coordinates.
- Parameters
-
min The minimum coordinate. max The 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]
|
inline |
Set the coordinates by the three points of a triangle.
- Parameters
-
a The first triangle coordinate. b The second triangle coordinate. c The 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]
|
inline |
Set the coordinates by a sphere.
The box is only approximated and slightly larger than it needs to be.
- Parameters
-
sphere The sphere to enclose.
References Murl::Math::Box< DataType >::Clear(), Murl::Math::Sphere< DataType >::GetCenter(), Murl::Math::Sphere< DataType >::GetRadius(), Murl::Math::Sphere< DataType >::IsEmpty(), Murl::Math::Box< DataType >::mFlags, Murl::Math::Box< DataType >::mMax, and Murl::Math::Box< DataType >::mMin.
◆ SetMinimum()
|
inline |
Set the minimum coordinate.
- Parameters
-
min The minimum coordinate.
References Murl::Math::Box< DataType >::mFlags, and Murl::Math::Box< DataType >::mMin.
◆ SetMaximum()
|
inline |
Set the maximum coordinate.
- Parameters
-
max The maximum coordinate.
References Murl::Math::Box< DataType >::mFlags, and Murl::Math::Box< DataType >::mMax.
◆ GetMinimum()
|
inline |
Get the minimum coordinate.
- Returns
- The minimum coordinate.
References Murl::Math::Box< DataType >::mMin.
Referenced by Murl::Math::Sphere< DataType >::Include(), Murl::Math::Sphere< DataType >::Set(), Murl::Math::Cylinder< DataType >::Set(), Murl::Math::Sphere< DataType >::SetBounding(), Murl::Math::Sphere< DataType >::SetContaining(), and Murl::Math::Sphere< DataType >::Unite().
◆ GetMaximum()
|
inline |
Get the maximum coordinate.
- Returns
- The maximum coordinate.
References Murl::Math::Box< DataType >::mMax.
Referenced by Murl::Math::Sphere< DataType >::Include(), Murl::Math::Sphere< DataType >::Set(), Murl::Math::Cylinder< DataType >::Set(), Murl::Math::Sphere< DataType >::SetBounding(), Murl::Math::Sphere< DataType >::SetContaining(), and Murl::Math::Sphere< DataType >::Unite().
◆ Unite()
|
inline |
Unite this box with another box.
- Parameters
-
other The other box to unite.
References Murl::Math::Box< DataType >::IsEmpty(), Murl::Math::Box< DataType >::mMax, Murl::Math::Box< DataType >::mMin, and Murl::Math::Box< DataType >::Set().
Referenced by Murl::Math::Box< DataType >::Box(), and Murl::Math::Box< DataType >::Set().
◆ Include()
|
inline |
Include a point in this box.
- Parameters
-
point The 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()
|
inline |
Check if a given box is intersecting this box.
- Parameters
-
other The 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()
|
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()
|
inline |
◆ ToString()
|
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