Lines with real coordinates. More...
#include <ogdf/basic/geometry.h>
Public Member Functions | |
| DLine () | |
| Creates an empty line. | |
| DLine (const DPoint &p1, const DPoint &p2) | |
| Creates a line with start point p1 and end point p2. | |
| DLine (const DLine &dl) | |
| Copy constructor. | |
| DLine (double x1, double y1, double x2, double y2) | |
| Creates a line with start point (x1,y1) and end point (x2,y2). | |
| bool | operator== (const DLine &dl) const |
| Equality operator. | |
| bool | operator!= (const DLine &dl) const |
| Inequality operator. | |
| DLine & | operator= (const DLine &dl) |
| Assignment operator. | |
| const DPoint & | start () const |
| Returns the start point of the line. | |
| const DPoint & | end () const |
| Returns the end point of the line. | |
| double | dx () const |
| Returns the x-coordinate of the difference (end point - start point). | |
| double | dy () const |
| Returns the y-coordinate of the difference (end point - start point). | |
| double | slope () const |
| Returns the slope of the line. | |
| double | yAbs () const |
| Returns the value y' such that (0,y') lies on the unlimited straight-line define dby this line. | |
| bool | isVertical () const |
| Returns true iff this line runs vertically. | |
| bool | isHorizontal () const |
| Returns true iff this line runs horizontally. | |
| bool | intersection (const DLine &line, DPoint &inter, bool endpoints=true) const |
| Returns true iff line and this line intersect. | |
| bool | contains (const DPoint &p) const |
| Returns true iff p lie on this line. | |
| double | length () const |
| Returns the length (euclidean distance between start and edn point) of this line. | |
| int | horIntersection (const double horAxis, double &crossing) const |
| Computes the intersection between this line and the horizontal line through y = horAxis. | |
| int | verIntersection (const double verAxis, double &crossing) const |
| Computes the intersection between this line and the vertical line through x = verAxis. | |
Protected Attributes | |
| DPoint | m_start |
| The start point of the line. | |
| DPoint | m_end |
| The end point of the line. | |
Lines with real coordinates.
Definition at line 388 of file geometry.h.
| ogdf::DLine::DLine | ( | ) | [inline] |
Creates an empty line.
Definition at line 397 of file geometry.h.
Creates a line with start point p1 and end point p2.
Definition at line 400 of file geometry.h.
| ogdf::DLine::DLine | ( | const DLine & | dl | ) | [inline] |
Copy constructor.
Definition at line 403 of file geometry.h.
| ogdf::DLine::DLine | ( | double | x1, | |
| double | y1, | |||
| double | x2, | |||
| double | y2 | |||
| ) | [inline] |
Creates a line with start point (x1,y1) and end point (x2,y2).
Definition at line 406 of file geometry.h.
| bool ogdf::DLine::contains | ( | const DPoint & | p | ) | const |
Returns true iff p lie on this line.
| double ogdf::DLine::dx | ( | ) | const [inline] |
Returns the x-coordinate of the difference (end point - start point).
Definition at line 436 of file geometry.h.
| double ogdf::DLine::dy | ( | ) | const [inline] |
Returns the y-coordinate of the difference (end point - start point).
Definition at line 439 of file geometry.h.
| const DPoint& ogdf::DLine::end | ( | ) | const [inline] |
Returns the end point of the line.
Definition at line 433 of file geometry.h.
| int ogdf::DLine::horIntersection | ( | const double | horAxis, | |
| double & | crossing | |||
| ) | const |
Computes the intersection between this line and the horizontal line through y = horAxis.
| horAxis | defines the horizontal line. | |
| crossing | is assigned the x-coordinate of the intersection point. |
Returns true iff line and this line intersect.
| line | is the second line. | |
| inter | is assigned the intersection point if true is returned. | |
| endpoints | determines if common endpoints are treated as intersection. |
| bool ogdf::DLine::isHorizontal | ( | ) | const [inline] |
Returns true iff this line runs horizontally.
Definition at line 451 of file geometry.h.
| bool ogdf::DLine::isVertical | ( | ) | const [inline] |
Returns true iff this line runs vertically.
Definition at line 448 of file geometry.h.
| double ogdf::DLine::length | ( | ) | const [inline] |
Returns the length (euclidean distance between start and edn point) of this line.
Definition at line 466 of file geometry.h.
| bool ogdf::DLine::operator!= | ( | const DLine & | dl | ) | const [inline] |
Inequality operator.
Definition at line 416 of file geometry.h.
Assignment operator.
Definition at line 421 of file geometry.h.
| bool ogdf::DLine::operator== | ( | const DLine & | dl | ) | const [inline] |
Equality operator.
Definition at line 411 of file geometry.h.
| double ogdf::DLine::slope | ( | ) | const [inline] |
Returns the slope of the line.
Definition at line 442 of file geometry.h.
| const DPoint& ogdf::DLine::start | ( | ) | const [inline] |
Returns the start point of the line.
Definition at line 430 of file geometry.h.
| int ogdf::DLine::verIntersection | ( | const double | verAxis, | |
| double & | crossing | |||
| ) | const |
Computes the intersection between this line and the vertical line through x = verAxis.
| verAxis | defines the vertical line. | |
| crossing | is assigned the y-coordinate of the intersection point. |
| double ogdf::DLine::yAbs | ( | ) | const [inline] |
Returns the value y' such that (0,y') lies on the unlimited straight-line define dby this line.
Definition at line 445 of file geometry.h.
DPoint ogdf::DLine::m_end [protected] |
The end point of the line.
Definition at line 392 of file geometry.h.
DPoint ogdf::DLine::m_start [protected] |
The start point of the line.
Definition at line 391 of file geometry.h.