Public Member Functions | Static Public Member Functions | Public Attributes | Friends
cinder::Area Class Reference

#include <Area.h>

List of all members.

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.
Area getOffset (const Vec2i &off) const
 Returns a copy of the Area translated by off.
void moveULTo (const Vec2i &newUL)
 Translates the Area so that its upper-left corner is newUL.
Area getMoveULTo (const Vec2i &newUL) const
 Returns a copy of the Area translated so that its upper-left corner is newUL.
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.
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.
void include (const std::vector< Vec2i > &points)
 Expands the Area to include all points in points in its interior.
void include (const Area &area)
 Expands the Area to include rect in its interior.
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.
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.
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.
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
Areaoperator+= (const Vec2i &o)
Areaoperator-= (const Vec2i &o)

Static Public Member Functions

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)

Constructor & Destructor Documentation

cinder::Area::Area ( const Vec2i UL,
const Vec2i LR 
)
cinder::Area::Area ( int32_t  aX1,
int32_t  aY1,
int32_t  aX2,
int32_t  aY2 
)
cinder::Area::Area ( const RectT< float > &  r) [explicit]

Member Function Documentation

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
int32_t cinder::Area::calcArea ( ) const
void cinder::Area::clipBy ( const Area clip)
Area cinder::Area::getClipBy ( const Area clip) const
void cinder::Area::offset ( const Vec2i off)

Translates the Area by off.

Area cinder::Area::getOffset ( const Vec2i off) const

Returns a copy of the Area translated by off.

void cinder::Area::moveULTo ( const Vec2i newUL)

Translates the Area so that its upper-left corner is newUL.

Area cinder::Area::getMoveULTo ( const Vec2i newUL) const

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)
bool cinder::Area::contains ( const Vec2i offset) const
template<typename Y >
bool cinder::Area::contains ( const Vec2< Y > &  offset) const
bool cinder::Area::intersects ( const Area area) const
void cinder::Area::include ( const Vec2i point)

Expands the Area to include point in its interior.

void cinder::Area::include ( const std::vector< Vec2i > &  points)

Expands the Area to include all points in points in its interior.

void cinder::Area::include ( const Area area)

Expands the Area to include rect in its interior.

template<typename Y >
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<typename Y >
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.

template<typename Y >
template Vec2f cinder::Area::closestPoint ( const Vec2< Y > &  pt) const

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
const Area cinder::Area::operator+ ( const Vec2i o) const
const Area cinder::Area::operator- ( const Vec2i o) const
const Area cinder::Area::operator+ ( const Area rhs) const
const Area cinder::Area::operator- ( const Area rhs) const
Area& cinder::Area::operator+= ( const Vec2i o)
Area& cinder::Area::operator-= ( const Vec2i o)
Area cinder::Area::proportionalFit ( const Area srcArea,
const Area dstArea,
bool  center,
bool  expand = false 
) [static]

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const Area area 
) [friend]

Member Data Documentation


The documentation for this class was generated from the following files: