Manifold 1.0
Robust computational geometry
 
Loading...
Searching...
No Matches
Box Struct Reference

Public Member Functions

 Box ()
 
 Box (const glm::vec3 p1, const glm::vec3 p2)
 
glm::vec3 Size () const
 
glm::vec3 Center () const
 
float Scale () const
 
bool Contains (const glm::vec3 &p) const
 
bool Contains (const Box &box) const
 
void Union (const glm::vec3 p)
 
Box Union (const Box &box) const
 
Box Transform (const glm::mat4x3 &transform) const
 
Box operator+ (glm::vec3 shift) const
 
Boxoperator+= (glm::vec3 shift)
 
Box operator* (glm::vec3 scale) const
 
Boxoperator*= (glm::vec3 scale)
 
bool DoesOverlap (const Box &box) const
 
bool DoesOverlap (glm::vec3 p) const
 
bool IsFinite () const
 

Public Attributes

glm::vec3 min = glm::vec3(std::numeric_limits<float>::infinity())
 
glm::vec3 max = glm::vec3(-std::numeric_limits<float>::infinity())
 

Constructor & Destructor Documentation

◆ Box() [1/2]

Box ( )
inline

Default constructor is an infinite box that contains all space.

◆ Box() [2/2]

Box ( const glm::vec3  p1,
const glm::vec3  p2 
)
inline

Creates a box that contains the two given points.

Member Function Documentation

◆ Size()

glm::vec3 Size ( ) const
inline

Returns the dimensions of the Box.

◆ Center()

glm::vec3 Center ( ) const
inline

Returns the center point of the Box.

◆ Scale()

float Scale ( ) const
inline

Returns the absolute-largest coordinate value of any contained point.

◆ Contains() [1/2]

bool Contains ( const glm::vec3 &  p) const
inline

Does this box contain (includes equal) the given point?

◆ Contains() [2/2]

bool Contains ( const Box box) const
inline

Does this box contain (includes equal) the given box?

◆ Union() [1/2]

void Union ( const glm::vec3  p)
inline

Expand this box to include the given point.

◆ Union() [2/2]

Box Union ( const Box box) const
inline

Expand this box to include the given box.

◆ Transform()

Box Transform ( const glm::mat4x3 &  transform) const
inline

Transform the given box by the given axis-aligned affine transform.

Ensure the transform passed in is axis-aligned (rotations are all multiples of 90 degrees), or else the resulting bounding box will no longer bound properly.

◆ operator+()

Box operator+ ( glm::vec3  shift) const
inline

Shift this box by the given vector.

◆ operator+=()

Box & operator+= ( glm::vec3  shift)
inline

Shift this box in-place by the given vector.

◆ operator*()

Box operator* ( glm::vec3  scale) const
inline

Scale this box by the given vector.

◆ operator*=()

Box & operator*= ( glm::vec3  scale)
inline

Scale this box in-place by the given vector.

◆ DoesOverlap() [1/2]

bool DoesOverlap ( const Box box) const
inline

Does this box overlap the one given (including equality)?

◆ DoesOverlap() [2/2]

bool DoesOverlap ( glm::vec3  p) const
inline

Does the given point project within the XY extent of this box (including equality)?

◆ IsFinite()

bool IsFinite ( ) const
inline

Does this box have finite bounds?