Cinder  0.9.1
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
cinder::RectT< T > Class Template Reference

#include <Rect.h>

Public Types

typedef glm::tvec2< T, glm::defaultpVec2T
 
typedef glm::tvec3< T, glm::defaultpVec3T
 
typedef glm::tmat3x3< T, glm::defaultpMat3T
 

Public Member Functions

 RectT ()
 
 RectT (const std::vector< Vec2T > &points)
 
 RectT (T aX1, T aY1, T aX2, T aY2)
 
 RectT (const Vec2T &v1, const Vec2T &v2)
 
 RectT (const Area &area)
 
void set (T aX1, T aY1, T aX2, T aY2)
 
getWidth () const
 
getHeight () const
 
getAspectRatio () const
 
calcArea () const
 
void canonicalize ()
 
RectT canonicalized () const
 
void clipBy (const RectT &clip)
 
RectT getClipBy (const RectT &clip) const
 
Area getInteriorArea () const
 
void offset (const Vec2T &offset)
 
RectT getOffset (const Vec2T &off) const
 
void moveULTo (const Vec2T &newUL)
 
RectT getMoveULTo (const Vec2T &newUL) const
 
void inflate (const Vec2T &amount)
 
RectT inflated (const Vec2T &amount) const
 
void offsetCenterTo (const Vec2T &center)
 
void scaleCentered (const Vec2T &scale)
 
RectT scaledCentered (const Vec2T &scale) const
 
void scaleCentered (T scale)
 
RectT scaledCentered (T scale) const
 
void scale (T scale)
 
void scale (const Vec2T &scale)
 
RectT scaled (T scale) const
 
RectT scaled (const Vec2T &scale) const
 
void transform (const Mat3T &matrix)
 
RectT transformed (const Mat3T &matrix) const
 
template<typename Y >
bool contains (const glm::tvec2< Y, glm::defaultp > &pt) const
 
bool contains (const Vec2T &pt) const
 
bool intersects (const RectT &rect) const
 
distance (const Vec2T &pt) const
 
distanceSquared (const Vec2T &pt) const
 
Vec2T closestPoint (const Vec2T &pt) const
 
getX1 () const
 
getY1 () const
 
getX2 () const
 
getY2 () const
 
Vec2T getUpperLeft () const
 
Vec2T getUpperRight () const
 
Vec2T getLowerRight () const
 
Vec2T getLowerLeft () const
 
Vec2T getCenter () const
 
Vec2T getSize () const
 
RectT getCenteredFit (const RectT &other, bool expand) const
 
RectT getCenteredFill (const RectT &other, bool contract) const
 
void include (const Vec2T &point)
 
void include (const std::vector< Vec2T > &points)
 
void include (const RectT &rect)
 
const RectT< T > operator+ (const Vec2T &o) const
 
const RectT< T > operator- (const Vec2T &o) const
 
const RectT< T > operator* (T s) const
 
const RectT< T > operator/ (T s) const
 
const RectT< T > operator+ (const RectT< T > &rhs) const
 
const RectT< T > operator- (const RectT< T > &rhs) const
 
RectT< T > & operator+= (const Vec2T &o)
 
RectT< T > & operator-= (const Vec2T &o)
 
RectT< T > & operator*= (T s)
 
RectT< T > & operator/= (T s)
 

Static Public Member Functions

static RectT zero ()
 

Public Attributes

x1
 
y1
 
x2
 
y2
 

Friends

std::ostream & operator<< (std::ostream &o, const RectT &rect)
 

Member Typedef Documentation

template<typename T>
typedef glm::tvec2<T, glm::defaultp> cinder::RectT< T >::Vec2T
template<typename T>
typedef glm::tvec3<T, glm::defaultp> cinder::RectT< T >::Vec3T
template<typename T>
typedef glm::tmat3x3<T, glm::defaultp> cinder::RectT< T >::Mat3T

Constructor & Destructor Documentation

template<typename T>
cinder::RectT< T >::RectT ( )
template<typename T >
cinder::RectT< T >::RectT ( const std::vector< Vec2T > &  points)

Initializes the rectangle to be the bounding box of points.

template<typename T>
cinder::RectT< T >::RectT ( aX1,
aY1,
aX2,
aY2 
)
template<typename T>
cinder::RectT< T >::RectT ( const Vec2T v1,
const Vec2T v2 
)
template<typename T>
cinder::RectT< T >::RectT ( const Area area)

Member Function Documentation

template<typename T>
void cinder::RectT< T >::set ( aX1,
aY1,
aX2,
aY2 
)
template<typename T>
T cinder::RectT< T >::getWidth ( ) const
template<typename T>
T cinder::RectT< T >::getHeight ( ) const
template<typename T>
T cinder::RectT< T >::getAspectRatio ( ) const
template<typename T>
T cinder::RectT< T >::calcArea ( ) const
template<typename T >
void cinder::RectT< T >::canonicalize ( )
template<typename T >
RectT< T > cinder::RectT< T >::canonicalized ( ) const
template<typename T >
void cinder::RectT< T >::clipBy ( const RectT< T > &  clip)
template<typename T >
RectT< T > cinder::RectT< T >::getClipBy ( const RectT< T > &  clip) const
template<typename T >
Area cinder::RectT< T >::getInteriorArea ( ) const
template<typename T >
void cinder::RectT< T >::offset ( const Vec2T offset)

Translates the RectT by off.

template<typename T >
RectT< T > cinder::RectT< T >::getOffset ( const Vec2T off) const

Returns a copy of the RectT translated by off.

template<typename T >
void cinder::RectT< T >::moveULTo ( const Vec2T newUL)

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

template<typename T >
RectT< T > cinder::RectT< T >::getMoveULTo ( const Vec2T newUL) const

Returns a copy of the RectT translated so that its upper-left corner is newUL.

template<typename T >
void cinder::RectT< T >::inflate ( const Vec2T amount)
template<typename T >
RectT< T > cinder::RectT< T >::inflated ( const Vec2T amount) const
template<typename T>
void cinder::RectT< T >::offsetCenterTo ( const Vec2T center)

Translates the rectangle so that its center is at center.

template<typename T >
void cinder::RectT< T >::scaleCentered ( const Vec2T scale)
template<typename T >
RectT< T > cinder::RectT< T >::scaledCentered ( const Vec2T scale) const
template<typename T>
void cinder::RectT< T >::scaleCentered ( scale)
template<typename T>
RectT< T > cinder::RectT< T >::scaledCentered ( scale) const
template<typename T>
void cinder::RectT< T >::scale ( scale)
template<typename T>
void cinder::RectT< T >::scale ( const Vec2T scale)
template<typename T>
RectT< T > cinder::RectT< T >::scaled ( scale) const
template<typename T>
RectT< T > cinder::RectT< T >::scaled ( const Vec2T scale) const
template<typename T >
void cinder::RectT< T >::transform ( const Mat3T matrix)

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

template<typename T >
RectT< T > cinder::RectT< T >::transformed ( const Mat3T matrix) const

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

template<typename T>
template<typename Y >
bool cinder::RectT< T >::contains ( const glm::tvec2< Y, glm::defaultp > &  pt) const

Is a point pt inside the rectangle.

template<typename T>
bool cinder::RectT< T >::contains ( const Vec2T pt) const
template<typename T >
bool cinder::RectT< T >::intersects ( const RectT< T > &  rect) const

Returns whether rect intersects with this.

template<typename T >
T cinder::RectT< T >::distance ( const Vec2T pt) const

Returns the distance between the point pt and the rectangle. Points inside the rectangle return 0.

template<typename T >
T cinder::RectT< T >::distanceSquared ( const Vec2T pt) const

Returns the squared distance between the point pt and the rectangle. Points inside the rectangle return 0.

template<typename T >
RectT< T >::Vec2T cinder::RectT< T >::closestPoint ( const Vec2T pt) const

Returns the nearest point on the Rect rect. Points inside the rectangle return pt.

template<typename T>
T cinder::RectT< T >::getX1 ( ) const
template<typename T>
T cinder::RectT< T >::getY1 ( ) const
template<typename T>
T cinder::RectT< T >::getX2 ( ) const
template<typename T>
T cinder::RectT< T >::getY2 ( ) const
template<typename T>
Vec2T cinder::RectT< T >::getUpperLeft ( ) const
template<typename T>
Vec2T cinder::RectT< T >::getUpperRight ( ) const
template<typename T>
Vec2T cinder::RectT< T >::getLowerRight ( ) const
template<typename T>
Vec2T cinder::RectT< T >::getLowerLeft ( ) const
template<typename T>
Vec2T cinder::RectT< T >::getCenter ( ) const
template<typename T>
Vec2T cinder::RectT< T >::getSize ( ) const
template<typename T >
RectT< T > cinder::RectT< T >::getCenteredFit ( const RectT< T > &  other,
bool  expand 
) const
Returns
Scaled copy with the same aspect ratio centered relative to and scaled to fit inside other. If expand then the rectangle is expanded if it is smaller than other
template<typename T >
RectT< T > cinder::RectT< T >::getCenteredFill ( const RectT< T > &  other,
bool  contract 
) const
Returns
Scaled copy with the same aspect ratio centered relative to and scaled so it completely fills other. If contract then the rectangle is contracted if it is larger than other
template<typename T >
void cinder::RectT< T >::include ( const Vec2T point)

Expands the Rect to include point in its interior

template<typename T >
void cinder::RectT< T >::include ( const std::vector< Vec2T > &  points)

Expands the Rect to include all points in points in its interior

template<typename T >
void cinder::RectT< T >::include ( const RectT< T > &  rect)

Expands the Rect to include rect in its interior

template<typename T>
const RectT<T> cinder::RectT< T >::operator+ ( const Vec2T o) const
template<typename T>
const RectT<T> cinder::RectT< T >::operator- ( const Vec2T o) const
template<typename T>
const RectT<T> cinder::RectT< T >::operator* ( s) const
template<typename T>
const RectT<T> cinder::RectT< T >::operator/ ( s) const
template<typename T>
const RectT<T> cinder::RectT< T >::operator+ ( const RectT< T > &  rhs) const
template<typename T>
const RectT<T> cinder::RectT< T >::operator- ( const RectT< T > &  rhs) const
template<typename T>
RectT<T>& cinder::RectT< T >::operator+= ( const Vec2T o)
template<typename T>
RectT<T>& cinder::RectT< T >::operator-= ( const Vec2T o)
template<typename T>
RectT<T>& cinder::RectT< T >::operator*= ( s)
template<typename T>
RectT<T>& cinder::RectT< T >::operator/= ( s)
template<typename T>
static RectT cinder::RectT< T >::zero ( )
static

Constructs a rectangle with all values initialized to zero.

Friends And Related Function Documentation

template<typename T>
std::ostream& operator<< ( std::ostream &  o,
const RectT< T > &  rect 
)
friend

Member Data Documentation

template<typename T>
T cinder::RectT< T >::x1
template<typename T>
T cinder::RectT< T >::y1
template<typename T>
T cinder::RectT< T >::x2
template<typename T>
T cinder::RectT< T >::y2

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