FdkBaseLib 2.1.1
|
#include <Box2.h>
Public Types | |
enum class | Corner : int32_t { MinMin , MaxMin , MaxMax , MinMax , NumCorners } |
XY corner identifiers. | |
enum class | Edge : int32_t { Bottom , Right , Top , Left , NumEdges } |
Edge identifiers. | |
Public Member Functions | |
Box2 () | |
Default ctor makes an empty-state bbox where min=<T>max() & max=-<T>max() | |
template<typename S > | |
Box2 (const Box2< S > &b) | |
Copy constructor. | |
Box2 (const T array[4]) | |
Box2 (T x, T y) | |
Box2 (T x, T y, T r, T t) | |
template<typename S > | |
Box2 (const Vec2< S > &_min, const Vec2< S > &_max) | |
Box2 (const Vec2< T > &v) | |
Box2 (const Vec2< T > *points, size_t nPoints) | |
The resulting Box2 is the intersection of all the source points. | |
operator Box2< fdk::half > () const | |
Transmogrify as a specific type: | |
operator Box2< float > () const | |
operator Box2< double > () const | |
operator Box2< int32_t > () const | |
Box2< fdk::half > | asBox2h () const |
Box2< float > | asBox2f () const |
Box2< double > | asBox2d () const |
Box2< int > | asBox2i () const |
void | set (T x, T y, T r, T t) |
template<typename S > | |
void | set (const Vec2< S > &_min, const Vec2< S > &_max) |
void | set (const T array[4]) |
void | set (T x, T y) |
template<typename S > | |
void | set (const Vec2< S > &v) |
void | set (const Box2< T > &b) |
template<typename S > | |
void | set (const Vec2< S > *points, size_t nPoints) |
The resulting Box2 is the intersection of all the source points. | |
void | setToZero () |
Set all components to 0. | |
void | setToOne () |
Set all components to 1. | |
void | setMin (const Vec2< T > &v) |
void | setMin (T x, T y) |
void | setMax (const Vec2< T > &v) |
void | setMax (T x, T y) |
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 Box2 &b) const |
Returns true if min and max are equal. Compares on each element individually. | |
bool | operator!= (const Box2 &b) const |
Returns true if any of the min and max values are different. Compares on each element individually. | |
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 | r () const |
right - max X | |
T | t () const |
top - max Y | |
T | w () const |
width | |
T | h () const |
height | |
T | cx () const |
center X | |
T | cy () const |
center Y | |
Vec2< T > | dimensions () const |
Return a Vec2 with width/height in it. | |
Vec2< T > | center () const |
Return the xy coordinate of the bbox center. | |
Vec2< T > | corner (Corner corner_index) const |
Return the xy coordinate of one of the corners. | |
T | radius () const |
T | minDim () const |
T | maxDim () const |
template<typename S > | |
bool | pointIsInside (const Vec2< S > &p) const |
Returns true if point is inside the box. | |
bool | pointIsInside (T x, T y) const |
void | pad (T d) |
Expand or contract the box by a set amount. | |
void | pad (const Vec2< T > &p) |
void | pad (T x, T y) |
void | shift (const Vec2< T > &p) |
Shift (translate) the position of the box. | |
void | shift (T x, T y) |
void | shiftMin (T x, T y) |
void | shiftMax (T x, T y) |
Box2< T > | operator+ (const Vec2< T > &v) const |
Box2< T > & | operator+= (const Vec2< T > &v) |
Box2< T > | operator- (const Vec2< T > &v) const |
Box2< T > & | operator-= (const Vec2< T > &v) |
template<typename S > | |
void | expand (const Box2< 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 Vec2< 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, bool test_empty=true) |
Box2< T > | intersect (const Box2< T > &v) const |
Find the union between the bbox and another. | |
template<typename S > | |
Box2< T > | interpolateTo (const Box2< T > &b, S t) const |
Interpolate between this Box2 and another at t, where t=0..1. | |
template<typename S > | |
Box2< T > | lerpClampedTo (const Box2< T > &b, S t) const |
Static Public Member Functions | |
static const char * | cornerName (Corner corner) |
static const char * | edgeName (Edge edge) |
Public Attributes | |
Vec2< T > | min |
"Lower-left" | |
Vec2< T > | max |
"Upper-right" | |
Static Public Attributes | |
static constexpr uint8_t | kNumElements = 4 |
Axis-aligned 2D bounding-box (AABB)
|
inline |
Interpolate between this Box2 and another at t, where t=0..1.
Interpolate between two bounding-boxes.
References fdk::Box2< T >::max, and fdk::Box2< T >::min.
©2024 The Foundry Visionmongers, Ltd. All Rights Reserved. |