Logo Search packages:      
Sourcecode: inkscape version File versions

NR::Rect Class Reference

#include <nr-rect.h>

List of all members.


Detailed Description

A rectangle is always aligned to the X and Y axis. This means it can be defined using only 4 coordinates, and determining intersection is very efficient. The points inside a rectangle are min[dim] <= _pt[dim] <= max[dim]. Emptiness, however, is defined as having zero area, meaning an empty rectangle may still contain points. Infinities are also permitted.

Definition at line 79 of file nr-rect.h.


Public Member Functions

double area () const
bool contains (const Point &p) const
bool contains (const Rect &r) const
Point corner (unsigned i) const
Point dimensions () const
void expandTo (const Rect &r)
void expandTo (Point p)
double extent (unsigned i) const throw (std::out_of_range)
double extent (Dim2 const axis) const
bool intersects (const Rect &r) const
bool isEmpty () const
const Point & max () const
double maxExtent () const
Point midpoint () const
const Point & min () const
void offset (Point p)
Rect operator* (double s) const
int operator== (const Rect &in_rect)
 Rect (const Point &p0, const Point &p1)
 Rect (const Rect &r)
 Rect (const NRRect &r)
void round (int places=0)
 Remove some precision from the Rect.

Static Public Member Functions

static Maybe< Rectintersection (const Rect &a, const Rect &b)
static Rect union_bounds (const Rect &a, const Rect &b)

Private Member Functions

template<Dim2 axis>
bool contains (const Point &p) const
template<Dim2 axis>
bool contains (const Rect &r) const
template<NR::Dim2 axis>
double extent () const
template<Dim2 axis>
bool intersects (const Rect &r) const
template<Dim2 axis>
bool isEmpty () const

Private Attributes

Point _max
Point _min

Friends

class Maybe< Rect >
std::ostream & operator<< (std::ostream &out_file, const NR::Rect &in_rect)

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

Generated by  Doxygen 1.6.0   Back to index