ipe::Rect Class Reference
Ipe Geometry

`#include <ipegeo.h>`

## Public Member Functions

| Rect ()
| Rect (const Vector &c)
| Rect (const Vector &c1, const Vector &c2)
void | clear ()
int | isEmpty () const
double | left () const
double | right () const
double | bottom () const
double | top () const
Vector | topRight () const
Vector | bottomLeft () const
Vector | topLeft () const
Vector | bottomRight () const
Vector | center () const
double | width () const
double | height () const
void | addPoint (const Vector &rhs)
void | addRect (const Rect &rhs)
void | clipTo (const Rect &rhs)
bool | contains (const Vector &rhs) const
bool | contains (const Rect &rhs) const
bool | certainClearance (const Vector &v, double bound) const
bool | intersects (const Rect &rhs) const

## Related Functions

(Note that these are not member functions.)
Stream & | operator<< (Stream &stream, const Rect &rhs)

## Detailed Description

Axis-parallel rectangle (which can be empty)

## Constructor & Destructor Documentation

## Rect() [1/3]

ipe::Rect::Rect | ( |  | ) |

inline explicit

Create empty rectangle.

Referenced by ipe::Vector::snap().

## Rect() [2/3]

ipe::Rect::Rect | ( | const Vector & | c | ) |

inline explicit

Create rectangle containing just the point c.

## Rect() [3/3]

Rect::Rect | ( | const Vector & | c1,
|  | const Vector & | c2
| ) |  |

explicit

Create rectangle containing points c1 and c2.

## Member Function Documentation

## clear()

void ipe::Rect::clear | ( |  | ) |

inline

Make rectangle empty.

Referenced by ipe::BBoxPainter::doNewPath().

## isEmpty()

int ipe::Rect::isEmpty | ( |  | ) | const

inline

True if rectangle is empty.

Referenced by addRect(), clipTo(), contains(), ipe::PdfWriter::createPageView(), ipe::BBoxPainter::doDrawPath(), ipe::PdfViewBase::drawPaper(), and intersects().

## left()

double ipe::Rect::left | ( |  | ) | const

inline

Return left side.

Referenced by ipe::PdfViewBase::drawPaper().

## right()

double ipe::Rect::right | ( |  | ) | const

inline

Return right side.

## bottom()

double ipe::Rect::bottom | ( |  | ) | const

inline

Return bottom side.

Referenced by ipe::PdfViewBase::drawPaper().

## top()

double ipe::Rect::top | ( |  | ) | const

inline

Return top side.

## topRight()

Vector ipe::Rect::topRight | ( |  | ) | const

inline

Return top right corner.

Referenced by ipe::Image::addToBBox(), ipe::Bezier::bbox(), certainClearance(), ipe::Image::distance(), ipe::BBoxPainter::doCurveTo(), ipe::BBoxPainter::doDrawPath(), ipe::BBoxPainter::doDrawText(), ipe::Painter::rect(), ipe::Shape::Shape(), ipe::Image::snapCtl(), ipe::CanvasBase::snapToPaperAndFrame(), and ipe::TransformTool::TransformTool().

## bottomLeft()

Vector ipe::Rect::bottomLeft | ( |  | ) | const

inline

Return bottom left corner.

Referenced by ipe::Image::addToBBox(), ipe::Bezier::bbox(), certainClearance(), ipe::Latex::createLatexSource(), ipe::Image::distance(), ipe::BBoxPainter::doCurveTo(), ipe::BBoxPainter::doDrawPath(), ipe::BBoxPainter::doDrawText(), ipe::Image::draw(), ipe::Painter::rect(), ipe::Shape::Shape(), ipe::Image::snapCtl(), ipe::CanvasBase::snapToPaperAndFrame(), and ipe::TransformTool::TransformTool().

## topLeft()

Vector ipe::Rect::topLeft | ( |  | ) | const

inline

Return top left corner.

Referenced by ipe::Image::addToBBox(), ipe::Image::distance(), ipe::Painter::rect(), ipe::Thumbnail::render(), ipe::Thumbnail::saveRender(), ipe::Shape::Shape(), ipe::Image::snapCtl(), and ipe::CanvasBase::snapToPaperAndFrame().

## bottomRight()

Vector ipe::Rect::bottomRight | ( |  | ) | const

inline

Return bottom right corner.

Referenced by ipe::Image::addToBBox(), ipe::Image::distance(), ipe::Painter::rect(), ipe::Shape::Shape(), ipe::Image::snapCtl(), and ipe::CanvasBase::snapToPaperAndFrame().

## center()

Vector ipe::Rect::center | ( |  | ) | const

inline

Return center of rectangle.

Referenced by ipe::Group::draw().

## width()

double ipe::Rect::width | ( |  | ) | const

inline

Return width.

Referenced by ipe::Image::draw(), ipe::Group::draw(), ipe::PdfViewBase::drawPaper(), ipe::PdfThumbnail::PdfThumbnail(), ipe::PdfThumbnail::render(), ipe::Thumbnail::saveRender(), ipe::Text::setXForm(), and ipe::Thumbnail::Thumbnail().

## height()

double ipe::Rect::height | ( |  | ) | const

inline

Return height.

Referenced by ipe::Image::draw(), ipe::Group::draw(), ipe::PdfViewBase::drawPaper(), ipe::PdfThumbnail::PdfThumbnail(), ipe::Thumbnail::saveRender(), ipe::Text::setXForm(), and ipe::Thumbnail::Thumbnail().

## addPoint()

void Rect::addPoint | ( | const Vector & | rhs | ) |

Enlarge rectangle to contain point.

References ipe::Vector::x, and ipe::Vector::y.

Referenced by ipe::Image::addToBBox(), ipe::Reference::addToBBox(), ipe::Text::addToBBox(), ipe::CurveSegment::addToBBox(), ipe::ClosedSpline::addToBBox(), ipe::Bezier::bbox(), ipe::Arc::bbox(), ipe::Latex::createLatexSource(), ipe::Image::distance(), ipe::Bezier::distance(), ipe::BBoxPainter::doCurveTo(), ipe::BBoxPainter::doDrawBitmap(), ipe::BBoxPainter::doDrawPath(), ipe::BBoxPainter::doDrawText(), ipe::BBoxPainter::doLineTo(), ipe::BBoxPainter::doMoveTo(), ipe::Image::Image(), ipe::Arc::intersect(), ipe::PdfFile::mediaBox(), and ipe::Bezier::snap().

## addRect()

void Rect::addRect | ( | const Rect & | rhs | ) |

Enlarge rectangle to contain rhs rectangle.

Does nothing if rhs is empty.

References isEmpty(), ipe::Vector::x, and ipe::Vector::y.

Referenced by ipe::CurveSegment::addToBBox(), ipe::Group::addToBBox(), ipe::Ellipse::addToBBox(), ipe::ClosedSpline::addToBBox(), ipe::BBoxPainter::doDrawBitmap(), ipe::BBoxPainter::doDrawText(), and ipe::TransformTool::TransformTool().

## clipTo()

void Rect::clipTo | ( | const Rect & | cbox | ) |

Clip rectangle to fit inside cbox.

Does nothing if either rectangle is empty.

References isEmpty(), ipe::Vector::x, and ipe::Vector::y.

Referenced by ipe::Group::addToBBox(), ipe::BBoxPainter::doDrawBitmap(), ipe::BBoxPainter::doDrawPath(), and ipe::BBoxPainter::doDrawText().

## contains() [1/2]

bool Rect::contains | ( | const Vector & | rhs | ) | const

Does (closed) rectangle contain the point?

References ipe::Vector::x, and ipe::Vector::y.

Referenced by ipe::SelectTool::mouseButton().

## contains() [2/2]

bool Rect::contains | ( | const Rect & | rhs | ) | const

Does rectangle contain other rectangle?

References isEmpty(), ipe::Vector::x, and ipe::Vector::y.

## certainClearance()

bool Rect::certainClearance | ( | const Vector & | v,
|  | double | bound
| ) |  | const

Returns false if the distance between the box and v is smaller than bound. Often returns true if their distance is larger than bound.

References bottomLeft(), topRight(), ipe::Vector::x, and ipe::Vector::y.

Referenced by ipe::Image::distance(), ipe::Bezier::distance(), and ipe::Bezier::snap().

## intersects()

bool Rect::intersects | ( | const Rect & | rhs | ) | const

Does rectangle intersect other rectangle?

References isEmpty(), ipe::Vector::x, and ipe::Vector::y.

Referenced by ipe::SelectTool::mouseButton(), and ipe::Bezier::snap().

## Friends And Related Function Documentation

## operator<<()

Stream & operator<< | ( | Stream & | stream,
|  | const Rect & | rhs
| ) |  |

related

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

- ipegeo.h
- ipegeo.cpp