small class which defines a 2D Box More...
#include <libwps_internal.h>
Classes | |
struct | PosSizeLt |
internal struct used to create sorted map, sorted first min then max More... |
Public Types | |
typedef std::map< Box2< T >, T, struct PosSizeLt > | Map |
map of Box2 |
Public Member Functions | |
Box2 (Vec2< T > minPt=Vec2< T >(), Vec2< T > maxPt=Vec2< T >()) | |
constructor | |
template<class U > | |
Box2 (Box2< U > const &p) | |
generic constructor | |
Vec2< T > const & | min () const |
the minimum 2D point (in x and in y) | |
Vec2< T > const & | max () const |
the maximum 2D point (in x and in y) | |
Vec2< T > & | min () |
the minimum 2D point (in x and in y) | |
Vec2< T > & | max () |
the maximum 2D point (in x and in y) | |
Vec2< T > const & | operator[] (int c) const |
the two extremum points which defined the box | |
Vec2< T > | size () const |
the box size | |
Vec2< T > | center () const |
the box center | |
void | set (Vec2< T > const &x, Vec2< T > const &y) |
resets the data to minimum x and maximum y | |
void | setMin (Vec2< T > const &x) |
resets the minimum point | |
void | setMax (Vec2< T > const &y) |
resets the maximum point | |
void | resizeFromMin (Vec2< T > const &sz) |
resize the box keeping the minimum | |
void | resizeFromMax (Vec2< T > const &sz) |
resize the box keeping the maximum | |
void | resizeFromCenter (Vec2< T > const &sz) |
resize the box keeping the center | |
template<class U > | |
void | scale (U factor) |
scales all points of the box by factor | |
void | extend (T val) |
extends the bdbox by (val, val) keeping the center | |
bool | operator== (Box2< T > const &p) const |
comparison operator== | |
bool | operator!= (Box2< T > const &p) const |
comparison operator!= | |
bool | operator< (Box2< T > const &p) const |
comparison operator< : fist sorts min by Y,X values then max extremity | |
int | cmp (Box2< T > const &p) const |
comparison function : fist sorts min by Y,X values then max extremity |
Protected Attributes | |
Vec2< T > | m_pt [2] |
the two extremities |
Friends | |
std::ostream & | operator<< (std::ostream &o, Box2< T > const &f) |
print data in form X0xY0<->X1xY1 |
small class which defines a 2D Box
|
inline |
constructor
generic constructor
comparison function : fist sorts min by Y,X values then max extremity
Referenced by Box2< float >::operator!=(), Box2< T >::PosSizeLt::operator()(), Box2< float >::operator<(), and Box2< float >::operator==().
|
inline |
extends the bdbox by (val, val) keeping the center
the maximum 2D point (in x and in y)
Referenced by WPSCell::Compare::Point::getPos().
the minimum 2D point (in x and in y)
Referenced by WPSCell::Compare::Point::getPos().
comparison operator!=
comparison operator< : fist sorts min by Y,X values then max extremity
comparison operator==
the two extremum points which defined the box
c | value 0 means the minimum |
c | value 1 means the maximum |
resize the box keeping the center
resize the box keeping the maximum
resize the box keeping the minimum
scales all points of the box by factor
resets the data to minimum x and maximum y
the box size
Referenced by WPSCell::Compare::Point::getSize(), and WPSCell::Compare::operator()().
|
friend |
print data in form X0xY0<->X1xY1
the two extremities
Referenced by Box2< float >::Box2(), Box2< float >::center(), Box2< float >::cmp(), Box2< float >::extend(), Box2< float >::max(), Box2< float >::min(), Box2< float >::operator[](), Box2< float >::resizeFromCenter(), Box2< float >::resizeFromMax(), Box2< float >::resizeFromMin(), Box2< float >::scale(), Box2< float >::set(), Box2< float >::setMax(), Box2< float >::setMin(), and Box2< float >::size().