Manifold 3.0
Robust geometry
 
Loading...
Searching...
No Matches
Box Struct Reference

Axis-aligned 3D box, primarily for bounding. More...

#include <common.h>

Public Member Functions

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

Public Attributes

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

Detailed Description

Axis-aligned 3D box, primarily for bounding.

Constructor & Destructor Documentation

◆ Box() [1/2]

Box ( )
inlineconstexpr

Default constructor is an infinite box that contains all space.

◆ Box() [2/2]

Box ( const vec3 p1,
const vec3 p2 )
inlineconstexpr

Creates a box that contains the two given points.

Member Function Documentation

◆ Size()

vec3 Size ( ) const
inlineconstexpr

Returns the dimensions of the Box.

◆ Center()

vec3 Center ( ) const
inlineconstexpr

Returns the center point of the Box.

◆ Scale()

double Scale ( ) const
inlineconstexpr

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

◆ Contains() [1/2]

bool Contains ( const vec3 & p) const
inlineconstexpr

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

◆ Contains() [2/2]

bool Contains ( const Box & box) const
inlineconstexpr

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

◆ Union() [1/2]

void Union ( const vec3 p)
inline

Expand this box to include the given point.

◆ Union() [2/2]

Box Union ( const Box & box) const
inlineconstexpr

Expand this box to include the given box.

◆ Transform()

Box Transform ( const mat3x4 & transform) const
inlineconstexpr

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+ ( vec3 shift) const
inlineconstexpr

Shift this box by the given vector.

◆ operator+=()

Box & operator+= ( vec3 shift)
inline

Shift this box in-place by the given vector.

◆ operator*()

Box operator* ( vec3 scale) const
inlineconstexpr

Scale this box by the given vector.

◆ operator*=()

Box & operator*= ( vec3 scale)
inline

Scale this box in-place by the given vector.

◆ DoesOverlap() [1/2]

bool DoesOverlap ( const Box & box) const
inlineconstexpr

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

◆ DoesOverlap() [2/2]

bool DoesOverlap ( vec3 p) const
inlineconstexpr

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

◆ IsFinite()

bool IsFinite ( ) const
inlineconstexpr

Does this box have finite bounds?