Rectangles with real coordinates. More...
#include <ogdf/basic/geometry.h>
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 (const DSegment &dl) | |
Creates a rectangle defined by the end points of line segment dl . 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... | |
virtual | ~DRect ()=default |
const DSegment | bottom () 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... | |
bool | intersection (const DSegment &segment) const |
Returns true iff segment intersects this DRect. More... | |
const DSegment | left () 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 DSegment | right () const |
Returns the right side of the rectangle. More... | |
const DSegment | top () 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 | |
double | parallelDist (const DSegment &d1, const DSegment &d2) const |
Computes distance between parallel line segments. More... | |
double | pointDist (const DPoint &p1, const DPoint &p2) const |
Computes distance between two points. 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 | |
std::ostream & | operator<< (std::ostream &os, const DRect &dr) |
Rectangles with real coordinates.
Definition at line 798 of file geometry.h.
|
default |
Creates a rectangle with lower left and upper right point (0,0).
Creates a rectangle with lower left point p1
and upper right point p2
.
Definition at line 810 of file geometry.h.
|
inline |
Copy constructor.
Definition at line 813 of file geometry.h.
|
inline |
Creates a rectangle with lower left point (x1
,y1
) and upper right point (x2
,y2
).
Definition at line 816 of file geometry.h.
|
inlineexplicit |
Creates a rectangle defined by the end points of line segment dl
.
Definition at line 819 of file geometry.h.
|
virtualdefault |
|
inline |
Returns the bottom side of the rectangle.
Definition at line 881 of file geometry.h.
|
inline |
Returns true iff p
lies within this rectangle, modulo the comparison epsilon OGDF_GEOM_ET.
Definition at line 892 of file geometry.h.
|
inline |
Returns the height of the rectangle.
Definition at line 842 of file geometry.h.
|
inline |
Returns true iff segment
intersects this DRect.
Definition at line 898 of file geometry.h.
|
inline |
Returns the left side of the rectangle.
Definition at line 876 of file geometry.h.
|
inline |
Normalizes the rectangle.
Makes sure that the lower left point lies below and left of the upper right point.
Definition at line 850 of file geometry.h.
|
inline |
Inequality operator.
Definition at line 827 of file geometry.h.
Assignment operator.
Definition at line 830 of file geometry.h.
|
inline |
Equality operator: both rectangles have the same coordinates.
Definition at line 824 of file geometry.h.
|
inline |
Returns the lower left point of the rectangle.
Definition at line 860 of file geometry.h.
|
inline |
Returns the upper right point of the rectangle.
Definition at line 863 of file geometry.h.
Computes distance between parallel line segments.
Computes distance between two points.
Definition at line 911 of file geometry.h.
|
inline |
Returns the right side of the rectangle.
Definition at line 871 of file geometry.h.
|
inline |
Returns the top side of the rectangle.
Definition at line 866 of file geometry.h.
|
inline |
Returns the width of the rectangle.
Definition at line 839 of file geometry.h.
|
inline |
Swaps the x-coordinates of the two points.
Definition at line 889 of file geometry.h.
|
inline |
Swaps the y-coordinates of the two points.
Definition at line 886 of file geometry.h.
|
friend |
|
protected |
The lower left point of the rectangle.
Definition at line 802 of file geometry.h.
|
protected |
The upper right point of the rectangle.
Definition at line 803 of file geometry.h.