# Cinder

# cinder::RectT< T > Class Template Reference

`#include <Rect.h>`

List of all members.

## Public Member Functions
| RectT ()
| RectT (const std::vector< Vec2< T > > &points)
| RectT (T aX1, T aY1, T aX2, T aY2)
| RectT (const Vec2< T > &v1, const Vec2< T > &v2)
| RectT (const Area &area)
void | set (T aX1, T aY1, T aX2, T aY2)
T | getWidth () const
T | getHeight () const
T | getAspectRatio () const
T | calcArea () const
void | canonicalize ()
RectT | canonicalized () const
void | clipBy (const RectT &clip)
RectT | getClipBy (const RectT &clip) const
Area | getInteriorArea () const
void | offset (const Vec2< T > &offset)
RectT | getOffset (const Vec2< T > &off)
void | offsetCenterTo (const Vec2< T > &center)
| Translates the rectangle so that its center is at center.
void | scaleCentered (const Vec2< T > &scale)
void | scaleCentered (T scale)
RectT | scaledCentered (T scale) const
void | scale (T scale)
RectT | scaled (T scale) const
template<typename Y >
bool | isInside (const Vec2< Y > &pt) const
| Is a point pt inside the rectangle.
bool | intersects (const RectT &rect) const
| Returns whether rect intersects with this.
T | getX1 () const
T | getY1 () const
T | getX2 () const
T | getY2 () const
Vec2< T > | getUpperLeft () const
Vec2< T > | getUpperRight () const
Vec2< T > | getLowerRight () const
Vec2< T > | getLowerLeft () const
Vec2< T > | getCenter () const
RectT | getCenteredFit (const RectT &other, bool expand) const
void | include (const Vec2< T > &point)
void | include (const std::vector< Vec2< T > > &points)
void | include (const RectT &rect)
## Public Attributes
T | x1
T | y1
T | x2
T | y2
## Friends
std::ostream & | operator<< (std::ostream &o, const RectT &rect)

### template<typename T>
class cinder::RectT< T >

## Constructor & Destructor Documentation

template<typename T>

cinder::RectT< T >::RectT | ( |  | ) |

template<typename T>

cinder::RectT< T >::RectT | ( | const std::vector< Vec2< T > > & | points | ) |

Initializes the rectangle to be the bounding box of points

template<typename T>

cinder::RectT< T >::RectT | ( | T | aX1,
|  | T | aY1,
|  | T | aX2,
|  | T | aY2 |
| ) |  |  |

template<typename T>

cinder::RectT< T >::RectT | ( | const Vec2< T > & | v1,
|  | const Vec2< T > & | v2 |
| ) |  |  |

template<typename T>

cinder::RectT< T >::RectT | ( | const Area & | area | ) |

## Member Function Documentation

template<typename T>

void cinder::RectT< T >::set | ( | T | aX1,
|  | T | aY1,
|  | T | aX2,
|  | T | 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 Vec2< T > & | offset | ) |

template<typename T>

RectT cinder::RectT< T >::getOffset | ( | const Vec2< T > & | off | ) |

template<typename T>

void cinder::RectT< T >::offsetCenterTo | ( | const Vec2< T > & | center | ) |

Translates the rectangle so that its center is at center.

template<typename T>

void cinder::RectT< T >::scaleCentered | ( | const Vec2< T > & | scale | ) |

template<typename T>

void cinder::RectT< T >::scaleCentered | ( | T | scale | ) |

template<typename T>

RectT< T > cinder::RectT< T >::scaledCentered | ( | T | scale | ) | const

template<typename T>

void cinder::RectT< T >::scale | ( | T | scale | ) |

template<typename T>

RectT< T > cinder::RectT< T >::scaled | ( | T | scale | ) | const

template<typename T>
template<typename Y >

bool cinder::RectT< T >::isInside | ( | const Vec2< Y > & | pt | ) | const

Is a point pt inside the rectangle.

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 >::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>

Vec2<T> cinder::RectT< T >::getUpperLeft | ( |  | ) | const

template<typename T>

Vec2<T> cinder::RectT< T >::getUpperRight | ( |  | ) | const

template<typename T>

Vec2<T> cinder::RectT< T >::getLowerRight | ( |  | ) | const

template<typename T>

Vec2<T> cinder::RectT< T >::getLowerLeft | ( |  | ) | const

template<typename T>

Vec2<T> cinder::RectT< T >::getCenter | ( |  | ) | 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>

void cinder::RectT< T >::include | ( | const Vec2< T > & | point | ) |

Expands the Rect to include point in its interior

template<typename T>

void cinder::RectT< T >::include | ( | const std::vector< Vec2< T > > & | 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

## 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:

- include/cinder/Rect.h
- src/cinder/Rect.cpp