#include <Area.h>
Public Member Functions | |
Area () | |
Area (const Vec2i &UL, const Vec2i &LR) | |
Area (int32_t aX1, int32_t aY1, int32_t aX2, int32_t aY2) | |
Area (const RectT< float > &r) | |
void | set (int32_t aX1, int32_t aY1, int32_t aX2, int32_t aY2) |
int32_t | getWidth () const |
int32_t | getHeight () const |
Vec2i | getSize () const |
Vec2f | getCenter () const |
int32_t | calcArea () const |
void | clipBy (const Area &clip) |
Area | getClipBy (const Area &clip) const |
void | offset (const Vec2i &off) |
Translates the Area by off. More... | |
Area | getOffset (const Vec2i &off) const |
Returns a copy of the Area translated by off. More... | |
void | moveULTo (const Vec2i &newUL) |
Translates the Area so that its upper-left corner is newUL. More... | |
Area | getMoveULTo (const Vec2i &newUL) const |
Returns a copy of the Area translated so that its upper-left corner is newUL. More... | |
void | expand (int32_t expandX, int32_t expandY) |
Expands the Area by expandX horizontally and expandY vertically. expandX is subtracted from x1 and added to x2 and expandY is subtracted from y1 and added to y2 . More... | |
int32_t | getX1 () const |
void | setX1 (int32_t aX1) |
int32_t | getY1 () const |
void | setY1 (int32_t aY1) |
int32_t | getX2 () const |
void | setX2 (int32_t aX2) |
int32_t | getY2 () const |
void | setY2 (int32_t aY2) |
Vec2i | getUL () const |
Vec2i | getLR () const |
bool | contains (const Vec2i &offset) const |
template<typename Y > | |
bool | contains (const Vec2< Y > &offset) const |
bool | intersects (const Area &area) const |
void | include (const Vec2i &point) |
Expands the Area to include point in its interior. More... | |
void | include (const std::vector< Vec2i > &points) |
Expands the Area to include all points in points in its interior. More... | |
void | include (const Area &area) |
Expands the Area to include rect in its interior. More... | |
template<typename Y > | |
float | distance (const Vec2< Y > &pt) const |
Returns the distance between the point pt and the rectangle. Points inside the Area return 0 . More... | |
template<typename Y > | |
float | distanceSquared (const Vec2< Y > &pt) const |
Returns the squared distance between the point pt and the rectangle. Points inside the rectangle return 0 . More... | |
template<typename Y > | |
Vec2< Y > | closestPoint (const Vec2< Y > &pt) const |
Returns the nearest point on the Rect rect. Points inside the rectangle return pt. More... | |
bool | operator== (const Area &aArea) const |
bool | operator< (const Area &aArea) const |
const Area | operator+ (const Vec2i &o) const |
const Area | operator- (const Vec2i &o) const |
const Area | operator+ (const Area &rhs) const |
const Area | operator- (const Area &rhs) const |
Area & | operator+= (const Vec2i &o) |
Area & | operator-= (const Vec2i &o) |
Static Public Member Functions | |
static Area | zero () |
Constructs an Area with all values initialized to zero. More... | |
static Area | proportionalFit (const Area &srcArea, const Area &dstArea, bool center, bool expand=false) |
Public Attributes | |
int32_t | x1 |
int32_t | y1 |
int32_t | x2 |
int32_t | y2 |
Friends | |
std::ostream & | operator<< (std::ostream &o, const Area &area) |
cinder::Area::Area | ( | ) |
cinder::Area::Area | ( | int32_t | aX1, |
int32_t | aY1, | ||
int32_t | aX2, | ||
int32_t | aY2 | ||
) |
|
explicit |
void cinder::Area::set | ( | int32_t | aX1, |
int32_t | aY1, | ||
int32_t | aX2, | ||
int32_t | aY2 | ||
) |
int32_t cinder::Area::getWidth | ( | ) | const |
int32_t cinder::Area::getHeight | ( | ) | const |
Vec2i cinder::Area::getSize | ( | ) | const |
Vec2f cinder::Area::getCenter | ( | ) | const |
int32_t cinder::Area::calcArea | ( | ) | const |
Returns a copy of the Area translated by off.
Translates the Area so that its upper-left corner is newUL.
Returns a copy of the Area translated so that its upper-left corner is newUL.
void cinder::Area::expand | ( | int32_t | expandX, |
int32_t | expandY | ||
) |
Expands the Area by expandX horizontally and expandY vertically. expandX is subtracted from x1
and added to x2
and expandY is subtracted from y1
and added to y2
.
int32_t cinder::Area::getX1 | ( | ) | const |
void cinder::Area::setX1 | ( | int32_t | aX1 | ) |
int32_t cinder::Area::getY1 | ( | ) | const |
void cinder::Area::setY1 | ( | int32_t | aY1 | ) |
int32_t cinder::Area::getX2 | ( | ) | const |
void cinder::Area::setX2 | ( | int32_t | aX2 | ) |
int32_t cinder::Area::getY2 | ( | ) | const |
void cinder::Area::setY2 | ( | int32_t | aY2 | ) |
Vec2i cinder::Area::getUL | ( | ) | const |
Vec2i cinder::Area::getLR | ( | ) | const |
bool cinder::Area::contains | ( | const Vec2i & | offset | ) | const |
bool cinder::Area::contains | ( | const Vec2< Y > & | offset | ) | const |
bool cinder::Area::intersects | ( | const Area & | area | ) | const |
Expands the Area to include point in its interior.
Expands the Area to include all points in points in its interior.
template float cinder::Area::distance | ( | const Vec2< Y > & | pt | ) | const |
Returns the distance between the point pt and the rectangle. Points inside the Area return 0
.
template float cinder::Area::distanceSquared | ( | const Vec2< Y > & | pt | ) | const |
Returns the squared distance between the point pt and the rectangle. Points inside the rectangle return 0
.
Returns the nearest point on the Rect rect. Points inside the rectangle return pt.
bool cinder::Area::operator== | ( | const Area & | aArea | ) | const |
bool cinder::Area::operator< | ( | const Area & | aArea | ) | const |
|
static |
|
friend |
int32_t cinder::Area::x1 |
int32_t cinder::Area::y1 |
int32_t cinder::Area::x2 |
int32_t cinder::Area::y2 |