Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

ogdf::DRect Class Reference

Rectangles with real coordinates. More...

#include <ogdf/basic/geometry.h>

+ Inheritance diagram for ogdf::DRect:

Public Member Functions

 DRect ()=default
 Creates a rectangle with lower left and upper right point (0,0). More...
 
 DRect (const DPoint &p1, const DPoint &p2)
 Creates a rectangle with lower left point p1 and upper right point p2. More...
 
 DRect (const DRect &dr)
 Copy constructor. More...
 
 DRect (double x1, double y1, double x2, double y2)
 Creates a rectangle with lower left point (x1,y1) and upper right point (x2,y2). More...
 
 DRect (const DLine &dl)
 Creates a rectangle defined by the end points of line dl. More...
 
virtual ~DRect ()=default
 
const DLine bottomLine () const
 Returns the bottom side of the rectangle. More...
 
bool contains (const DPoint &p) const
 Returns true iff p lies within this rectangle, modulo the comparison epsilon OGDF_GEOM_ET. More...
 
double height () const
 Returns the height of the rectangle. More...
 
const DLine leftLine () const
 Returns the left side of the rectangle. More...
 
void normalize ()
 Normalizes the rectangle. More...
 
bool operator!= (const DRect &dr) const
 Inequality operator. More...
 
DRect & operator= (const DRect &dr)
 Assignment operator. More...
 
bool operator== (const DRect &dr) const
 Equality operator: both rectangles have the same coordinates. More...
 
const DPoint & p1 () const
 Returns the lower left point of the rectangle. More...
 
const DPoint & p2 () const
 Returns the upper right point of the rectangle. More...
 
const DLine rightLine () const
 Returns the right side of the rectangle. More...
 
const DLine topLine () const
 Returns the top side of the rectangle. More...
 
double width () const
 Returns the width of the rectangle. More...
 
void xInvert ()
 Swaps the x-coordinates of the two points. More...
 
void yInvert ()
 Swaps the y-coordinates of the two points. More...
 

Protected Member Functions

DLine bottom () const
 Bottom bounding line. More...
 
DLine left () const
 Left bounding line. More...
 
double parallelDist (const DLine &d1, const DLine &d2) const
 Computes distance between parallel line segments. More...
 
double pointDist (const DPoint &p1, const DPoint &p2) const
 Computes distance between two points. More...
 
DLine right () const
 Right bounding line. More...
 
DLine top () const
 Top bounding line. More...
 

Protected Attributes

DPoint m_p1
 The lower left point of the rectangle. More...
 
DPoint m_p2
 The upper right point of the rectangle. More...
 

Friends

ostream & operator<< (ostream &os, const DRect &dr)
 

Detailed Description

Rectangles with real coordinates.

Definition at line 515 of file geometry.h.

Constructor & Destructor Documentation

◆ DRect() [1/5]

ogdf::DRect::DRect ( )
default

Creates a rectangle with lower left and upper right point (0,0).

◆ DRect() [2/5]

ogdf::DRect::DRect ( const DPoint &  p1,
const DPoint &  p2 
)
inline

Creates a rectangle with lower left point p1 and upper right point p2.

Definition at line 528 of file geometry.h.

◆ DRect() [3/5]

ogdf::DRect::DRect ( const DRect &  dr)
inline

Copy constructor.

Definition at line 534 of file geometry.h.

◆ DRect() [4/5]

ogdf::DRect::DRect ( double  x1,
double  y1,
double  x2,
double  y2 
)
inline

Creates a rectangle with lower left point (x1,y1) and upper right point (x2,y2).

Definition at line 539 of file geometry.h.

◆ DRect() [5/5]

ogdf::DRect::DRect ( const DLine &  dl)
inlineexplicit

Creates a rectangle defined by the end points of line dl.

Definition at line 543 of file geometry.h.

◆ ~DRect()

virtual ogdf::DRect::~DRect ( )
virtualdefault

Member Function Documentation

◆ bottom()

DLine ogdf::DRect::bottom ( ) const
inlineprotected

Bottom bounding line.

Definition at line 630 of file geometry.h.

◆ bottomLine()

const DLine ogdf::DRect::bottomLine ( ) const
inline

Returns the bottom side of the rectangle.

Definition at line 610 of file geometry.h.

◆ contains()

bool ogdf::DRect::contains ( const DPoint &  p) const
inline

Returns true iff p lies within this rectangle, modulo the comparison epsilon OGDF_GEOM_ET.

Definition at line 621 of file geometry.h.

◆ height()

double ogdf::DRect::height ( ) const
inline

Returns the height of the rectangle.

Definition at line 573 of file geometry.h.

◆ left()

DLine ogdf::DRect::left ( ) const
inlineprotected

Left bounding line.

Definition at line 636 of file geometry.h.

◆ leftLine()

const DLine ogdf::DRect::leftLine ( ) const
inline

Returns the left side of the rectangle.

Definition at line 605 of file geometry.h.

◆ normalize()

void ogdf::DRect::normalize ( )
inline

Normalizes the rectangle.

Makes sure that the lower left point lies below and left of the upper right point.

Definition at line 583 of file geometry.h.

◆ operator!=()

bool ogdf::DRect::operator!= ( const DRect &  dr) const
inline

Inequality operator.

Definition at line 554 of file geometry.h.

◆ operator=()

DRect& ogdf::DRect::operator= ( const DRect &  dr)
inline

Assignment operator.

Definition at line 559 of file geometry.h.

◆ operator==()

bool ogdf::DRect::operator== ( const DRect &  dr) const
inline

Equality operator: both rectangles have the same coordinates.

Definition at line 549 of file geometry.h.

◆ p1()

const DPoint& ogdf::DRect::p1 ( ) const
inline

Returns the lower left point of the rectangle.

Definition at line 589 of file geometry.h.

◆ p2()

const DPoint& ogdf::DRect::p2 ( ) const
inline

Returns the upper right point of the rectangle.

Definition at line 592 of file geometry.h.

◆ parallelDist()

double ogdf::DRect::parallelDist ( const DLine &  d1,
const DLine &  d2 
) const
protected

Computes distance between parallel line segments.

◆ pointDist()

double ogdf::DRect::pointDist ( const DPoint &  p1,
const DPoint &  p2 
) const
inlineprotected

Computes distance between two points.

Definition at line 645 of file geometry.h.

◆ right()

DLine ogdf::DRect::right ( ) const
inlineprotected

Right bounding line.

Definition at line 639 of file geometry.h.

◆ rightLine()

const DLine ogdf::DRect::rightLine ( ) const
inline

Returns the right side of the rectangle.

Definition at line 600 of file geometry.h.

◆ top()

DLine ogdf::DRect::top ( ) const
inlineprotected

Top bounding line.

Definition at line 633 of file geometry.h.

◆ topLine()

const DLine ogdf::DRect::topLine ( ) const
inline

Returns the top side of the rectangle.

Definition at line 595 of file geometry.h.

◆ width()

double ogdf::DRect::width ( ) const
inline

Returns the width of the rectangle.

Definition at line 568 of file geometry.h.

◆ xInvert()

void ogdf::DRect::xInvert ( )
inline

Swaps the x-coordinates of the two points.

Definition at line 618 of file geometry.h.

◆ yInvert()

void ogdf::DRect::yInvert ( )
inline

Swaps the y-coordinates of the two points.

Definition at line 615 of file geometry.h.

Friends And Related Function Documentation

◆ operator<<

ostream& operator<< ( ostream &  os,
const DRect &  dr 
)
friend

Member Data Documentation

◆ m_p1

DPoint ogdf::DRect::m_p1
protected

The lower left point of the rectangle.

Definition at line 520 of file geometry.h.

◆ m_p2

DPoint ogdf::DRect::m_p2
protected

The upper right point of the rectangle.

Definition at line 521 of file geometry.h.


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