FdkBaseLib 2.1.1
|
#include <Box3.h>
Public Types | |
enum class | Corner : int32_t { MinMinMin , MaxMinMin , MaxMaxMin , MinMaxMin , MinMinMax , MaxMinMax , MaxMaxMax , MinMaxMax , NumCorners } |
XYZ corner identifiers. | |
enum class | Face : int32_t { Front , Back , Bottom , Top , Left , Right , NumFaces } |
Face identifiers. | |
Public Member Functions | |
Box3 () | |
Default ctor makes an empty-state bbox where min=<T>max() & max=-<T>max() | |
template<typename S > | |
Box3 (const Box3< S > &b) | |
Copy constructor supports conversion from another type. | |
Box3 (const T array[6]) | |
Box3 (T x, T y, T z, T r, T t, T f) | |
template<typename S > | |
Box3 (const Vec3< S > &_min, const Vec3< S > &_max) | |
Box3 (T x, T y, T z) | |
Box3 (const Vec3< T > &p) | |
template<typename S > | |
Box3 (const Vec3< S > *points, size_t nPoints) | |
The resulting Box3 is the intersection of all the source points. | |
template<typename S > | |
Box3 (const Vec3< S > *points, size_t nPoints, const Mat4< T > &xform) | |
The resulting Box3 is the intersection of all the source points transformed by 'xform'. | |
operator Box3< fdk::half > () const | |
Transmogrify as a specific type: | |
operator Box3< float > () const | |
operator Box3< double > () const | |
operator Box3< int32_t > () const | |
Box3< fdk::half > | asBox3h () const |
Box3< float > | asBox3f () const |
Box3< double > | asBox3d () const |
Box3< int > | asBox3i () const |
void | set (T x, T y, T z, T r, T t, T f) |
template<typename S > | |
void | set (const Vec3< S > &_min, const Vec3< S > &_max) |
void | set (const T array[6]) |
void | set (T x, T y, T z) |
template<typename S > | |
void | set (const Vec3< S > &v) |
void | set (const Box3< T > &b) |
template<typename S > | |
void | set (const Vec3< S > *points, size_t nPoints) |
The resulting Box3 is the intersection of all the source points. | |
template<typename S > | |
void | set (const Vec3< S > *points, size_t nPoints, const Mat4< T > &xform) |
The resulting Box3 is the intersection of all the source points transformed by 'xform'. | |
void | setToZero () |
Set all components to 0 or 1. | |
void | setToOne () |
void | setMin (const Vec3< T > &v) |
void | setMin (T x, T y, T z) |
void | setMax (const Vec3< T > &v) |
void | setMax (T x, T y, T z) |
void | setToEmptyState () |
Sets box to empty state where min=<T>max() & max=-<T>max(). | |
bool | isEmpty () const |
Return true if the box is in an empty state (min=<T>max() & max=-<T>max().) | |
void | clear () |
Type-specific clear. Sets box to empty state where min=<T>max() & max=-<T>max(). | |
void | append (fdk::Hash &hash) const |
Add this to a fdk::Hash object. | |
bool | operator== (const Box3 &b) const |
Returns true if min and max are equal. Compares on each element individually. | |
bool | operator!= (const Box3 &b) const |
Returns true if any of the min and max values are different. Compares on each element individually. | |
template<typename S > | |
Box3 | operator* (const Mat4< S > &m) const |
template<typename S > | |
Box3 & | operator*= (const Mat4< S > &m) |
T * | array () |
Return a pointer to min.x. | |
const T * | array () const |
T | x () const |
left - min X | |
T | y () const |
bottom - min Y | |
T | z () const |
near - min Z | |
T | r () const |
right - max X | |
T | t () const |
top - max Y | |
T | f () const |
far - max Z | |
T | w () const |
width | |
T | h () const |
height | |
T | d () const |
depth | |
T | cx () const |
center X | |
T | cy () const |
center Y | |
T | cz () const |
center Z | |
Vec3< T > | dimensions () const |
Return a Vec3 with width/height/depth in it. | |
Vec3< T > | center () const |
Return the xyz coordinate of the bbox center. | |
Vec3< T > | corner (Corner corner_index) const |
Return the xyz coordinate of one of the corners. | |
T | radius () const |
T | minDim () const |
T | maxDim () const |
template<typename S > | |
bool | pointIsInside (const Vec3< S > &p) const |
Returns true if point is inside the box. | |
bool | pointIsInside (T x, T y, T z) const |
void | pad (T d) |
Expand or contract the box by a set amount. | |
void | pad (const Vec3< T > &p) |
void | pad (T x, T y, T z) |
void | shift (const Vec3< T > &p) |
Shift the position of the box. | |
void | shift (T x, T y, T z) |
void | shiftMin (T x, T y, T z) |
void | shiftMax (T x, T y, T z) |
Box3< T > | operator+ (const Vec3< T > &v) const |
Box3< T > & | operator+= (const Vec3< T > &v) |
Box3< T > | operator- (const Vec3< T > &v) const |
Box3< T > & | operator-= (const Vec3< T > &v) |
template<typename S > | |
void | expand (const Box3< S > &b, bool test_empty=true) |
Union the box with another. If this one is empty the other (non-empty) box is copied. | |
template<typename S > | |
void | expand (const Vec3< S > &p, bool test_empty=true) |
Expand the box to contain a point. If empty the box is set to a zero-size at the point. | |
void | expand (T x, T y, T z, bool test_empty=true) |
Box3< T > | intersect (const Box3< T > &v) const |
Find the union between the bbox and another. | |
template<typename S > | |
bool | project (const Mat4< T > &m, Box2< S > &box2D_out) const |
template<typename S > | |
uint32_t | projectCorner (Corner corner_index, const Mat4< T > &m, Box2< S > &box2D_out) const |
template<typename S > | |
Box3< T > | interpolateTo (const Box3< T > &b, S t) const |
Interpolate between this Box3 and another at t, where t=0..1. | |
template<typename S > | |
Box3< T > | lerpClampedTo (const Box3< T > &b, S t) const |
bool | intersects (const Box3< T > &box) const |
Return true if the box intersects with box. | |
bool | intersects (const Vec3< T > &point) const |
Return true if 'a point is inside the box. | |
T | surface () const |
Return the surface area of the box. | |
unsigned int | majorAxis () const |
Return the longest axis. | |
void | split (unsigned int axis, bool firstHalf) |
Split the box along axis, keeping the first or second half according to firstHalf. | |
void | transform (const Mat4< T > &m) |
Transform each corner with m, and set this box to the axis-aligned bounds of the new corners. | |
template<typename S > | |
Box3< T > | operator* (const Mat4< S > &m) const |
template<typename S > | |
Box3< T > & | operator*= (const Mat4< S > &m) |
Static Public Member Functions | |
static const char * | cornerName (Corner corner) |
static const char * | faceName (Face face) |
template<typename S > | |
static uint32_t | projectCorner (T x, T y, T z, const Mat4< T > &m, Box2< S > &box2D_out) |
Returns 1 if xyz point projects behind origin, ie an 'outside corner'. | |
Public Attributes | |
Vec3< T > | min |
"Lower-left-near" | |
Vec3< T > | max |
"Upper-right-far" | |
Static Public Attributes | |
static constexpr uint8_t | kNumElements = 6 |
Axis-aligned 3D bounding-box (AABB)
|
inline |
Project the corners of the bbox by a 4x4 matrix onto a 2D plane. If all corners project behind the origin return false and an empty box.
References fdk::Box2< T >::setToEmptyState(), and fdk::Vec3< T >::z.
|
inlinestatic |
Returns 1 if xyz point projects behind origin, ie an 'outside corner'.
Returns 1 if point projects behind origin, ie an 'outside corner'. Expands the passed in Box2.
References fdk::Box2< T >::expand(), and fdk::Vec4< T >::w.
|
inline |
Returns 1 if point projects behind origin, ie an 'outside corner'. Expands the passed in Box2.
References fdk::Vec3< T >::z.
|
inline |
Interpolate between this Box3 and another at t, where t=0..1.
Interpolate between two bounding-boxes.
References fdk::Box3< T >::max, and fdk::Box3< T >::min.
©2024 The Foundry Visionmongers, Ltd. All Rights Reserved. |