Ipelib
Public Member Functions | Related Functions | List of all members
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
 

Related Functions

(Note that these are not member functions.)

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.

◆ 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.

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

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

◆ isEmpty()

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

◆ left()

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

Return left side.

References ipe::Vector::x.

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

◆ right()

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

Return right side.

References ipe::Vector::x.

◆ bottom()

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

Return bottom side.

References ipe::Vector::y.

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

◆ top()

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

Return top side.

References ipe::Vector::y.

◆ topRight()

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

◆ bottomLeft()

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

◆ topLeft()

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

◆ bottomRight()

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

◆ center()

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

Return center of rectangle.

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

◆ width()

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

◆ height()

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

◆ addPoint()

void Rect::addPoint ( const Vector rhs)

◆ addRect()

void Rect::addRect ( const Rect rhs)

◆ clipTo()

void Rect::clipTo ( const Rect cbox)

Clip rectangle to fit inside cbox.

Does nothing if either rectangle is empty.

References intersects(), 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 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 clipTo(), and ipe::SelectTool::mouseButton().

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: