Ipelib
ipe::Rect Class Reference

#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

(Note that these are not member symbols.)

Streamoperator<< (Stream &stream, const Rect &rhs)

Detailed Description

Axis-parallel rectangle (which can be empty)

Constructor & Destructor Documentation

◆ Rect() [1/3]

ipe::Rect::Rect ( )
inlineexplicit

Create empty rectangle.

Referenced by addRect(), clipTo(), contains(), intersects(), and operator<<().

◆ Rect() [2/3]

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

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.

References addPoint().

Member Function Documentation

◆ clear()

void ipe::Rect::clear ( )
inline

Make rectangle empty.

◆ isEmpty()

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

True if rectangle is empty.

Referenced by addPoint(), addRect(), clipTo(), contains(), ipe::PdfWriter::createPageView(), and intersects().

◆ left()

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

Return left side.

◆ right()

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

Return right side.

◆ bottom()

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

Return bottom side.

◆ top()

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

Return top side.

◆ topRight()

◆ bottomLeft()

◆ topLeft()

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

◆ bottomRight()

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

Return bottom right corner.

Referenced by ipe::Painter::rect(), ipe::Shape::Shape(), and ipe::CanvasBase::snapToPaperAndFrame().

◆ center()

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

Return center of rectangle.

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

◆ width()

◆ height()

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

◆ addPoint()

◆ addRect()

void Rect::addRect ( const Rect & rhs)

Enlarge rectangle to contain rhs rectangle.

Does nothing if rhs is empty.

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

Referenced by ipe::ClosedSpline::addToBBox(), ipe::CurveSegment::addToBBox(), ipe::Ellipse::addToBBox(), and ipe::Group::addToBBox().

◆ clipTo()

void Rect::clipTo ( const Rect & cbox)

Clip rectangle to fit inside cbox.

Does nothing if either rectangle is empty.

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

Referenced by ipe::Group::addToBBox(), ipe::BBoxPainter::doDrawBitmap(), 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(), Rect(), 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 ipe::Vector::x, and ipe::Vector::y.

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

◆ intersects()

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

Does rectangle intersect other rectangle?

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

Referenced by clipTo(), and ipe::SelectTool::mouseButton().

◆ operator<<()

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

References Rect().


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