Cinder  0.9.1
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
cinder::Area Class Reference

#include <Area.h>

Public Member Functions

 Area ()
 
 Area (const ivec2 &UL, const ivec2 &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
 
ivec2 getSize () const
 
vec2 getCenter () const
 
int32_t calcArea () const
 
void clipBy (const Area &clip)
 
Area getClipBy (const Area &clip) const
 
void offset (const ivec2 &off)
 
Area getOffset (const ivec2 &off) const
 
void moveULTo (const ivec2 &newUL)
 
Area getMoveULTo (const ivec2 &newUL) const
 
void expand (int32_t expandX, int32_t expandY)
 
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)
 
ivec2 getUL () const
 
ivec2 getLR () const
 
bool contains (const ivec2 &offset) const
 
template<typename T >
bool contains (const glm::tvec2< T, glm::defaultp > &offset) const
 
bool intersects (const Area &area) const
 
void include (const ivec2 &point)
 
void include (const std::vector< ivec2 > &points)
 
void include (const Area &area)
 
float distance (const vec2 &pt) const
 
float distance (const dvec2 &pt) const
 
float distance (const ivec2 &pt) const
 
float distanceSquared (const vec2 &pt) const
 
float distanceSquared (const dvec2 &pt) const
 
float distanceSquared (const ivec2 &pt) const
 
vec2 closestPoint (const vec2 &pt) const
 
ivec2 closestPoint (const ivec2 &pt) const
 
dvec2 closestPoint (const dvec2 &pt) const
 
void transform (const mat3 &matrix)
 
Area transformed (const mat3 &matrix) const
 
bool operator== (const Area &rhs) const
 
bool operator!= (const Area &rhs) const
 
bool operator< (const Area &aArea) const
 
const Area operator+ (const ivec2 &o) const
 
const Area operator- (const ivec2 &o) const
 
const Area operator+ (const Area &rhs) const
 
const Area operator- (const Area &rhs) const
 
Areaoperator+= (const ivec2 &o)
 
Areaoperator-= (const ivec2 &o)
 

Static Public Member Functions

static Area zero ()
 
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 ( )
cinder::Area::Area ( const ivec2 &  UL,
const ivec2 &  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
ivec2 cinder::Area::getSize ( ) const
vec2 cinder::Area::getCenter ( ) 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 ivec2 &  off)

Translates the Area by off.

Area cinder::Area::getOffset ( const ivec2 &  off) const

Returns a copy of the Area translated by off.

void cinder::Area::moveULTo ( const ivec2 &  newUL)

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

Area cinder::Area::getMoveULTo ( const ivec2 &  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)
ivec2 cinder::Area::getUL ( ) const
ivec2 cinder::Area::getLR ( ) const
bool cinder::Area::contains ( const ivec2 &  offset) const
template<typename T >
bool cinder::Area::contains ( const glm::tvec2< T, glm::defaultp > &  offset) const
bool cinder::Area::intersects ( const Area area) const
void cinder::Area::include ( const ivec2 &  point)

Expands the Area to include point in its interior.

void cinder::Area::include ( const std::vector< ivec2 > &  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.

float cinder::Area::distance ( const vec2 &  pt) const
float cinder::Area::distance ( const dvec2 &  pt) const
float cinder::Area::distance ( const ivec2 &  pt) const
float cinder::Area::distanceSquared ( const vec2 &  pt) const
float cinder::Area::distanceSquared ( const dvec2 &  pt) const
float cinder::Area::distanceSquared ( const ivec2 &  pt) const
vec2 cinder::Area::closestPoint ( const vec2 &  pt) const
ivec2 cinder::Area::closestPoint ( const ivec2 &  pt) const
dvec2 cinder::Area::closestPoint ( const dvec2 &  pt) const
void cinder::Area::transform ( const mat3 &  matrix)

Transforms the Area by matrix. Represents the bounding box of the transformed Area when matrix expresses non-scale/translate operations.

Area cinder::Area::transformed ( const mat3 &  matrix) const

Returns a copy of the Area transformed by matrix. Represents the bounding box of the transformed Area when matrix expresses non-scale/translate operations.

bool cinder::Area::operator== ( const Area rhs) const
bool cinder::Area::operator!= ( const Area rhs) const
bool cinder::Area::operator< ( const Area aArea) const
const Area cinder::Area::operator+ ( const ivec2 &  o) const
const Area cinder::Area::operator- ( const ivec2 &  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 ivec2 &  o)
Area& cinder::Area::operator-= ( const ivec2 &  o)
static Area cinder::Area::zero ( )
static

Constructs an Area with all values initialized to zero.

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

int32_t cinder::Area::x1
int32_t cinder::Area::y1
int32_t cinder::Area::x2
int32_t cinder::Area::y2

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