# OpenGraph DrawingFramework

v.2012.07

ogdf::DLine Class Reference

Lines with real coordinates. More...

#include <ogdf/basic/geometry.h>

Inheritance diagram for ogdf::DLine:

List of all members.

## 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 contains (const DPoint &p) const
Returns true iff p lie on this 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).
const DPointend () const
Returns the end point of the line.
int horIntersection (const double horAxis, double &crossing) const
Computes the intersection between this line and the horizontal line through y = horAxis.
bool intersection (const DLine &line, DPoint &inter, bool endpoints=true) const
Returns true iff line and this line intersect.
bool isHorizontal () const
Returns true iff this line runs horizontally.
bool isVertical () const
Returns true iff this line runs vertically.
double length () const
Returns the length (euclidean distance between start and edn point) of this line.
bool operator!= (const DLine &dl) const
Inequality operator.
DLineoperator= (const DLine &dl)
Assignment operator.
bool operator== (const DLine &dl) const
Equality operator.
double slope () const
Returns the slope of the line.
const DPointstart () const
Returns the start point of the line.
int verIntersection (const double verAxis, double &crossing) const
Computes the intersection between this line and the vertical line through x = verAxis.
double yAbs () const
Returns the value y' such that (0,y') lies on the unlimited straight-line define dby this line.

## Protected Attributes

DPoint m_end
The end point of the line.
DPoint m_start
The start point of the line.

## Detailed Description

Lines with real coordinates.

Definition at line 383 of file geometry.h.

## Constructor & Destructor Documentation

 ogdf::DLine::DLine ( )
inline

Creates an empty line.

Definition at line 392 of file geometry.h.

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

Creates a line with start point p1 and end point p2.

Definition at line 395 of file geometry.h.

 ogdf::DLine::DLine ( const DLine & dl )
inline

Copy constructor.

Definition at line 398 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 401 of file geometry.h.

## Member Function Documentation

 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 431 of file geometry.h.

 double ogdf::DLine::dy ( ) const
inline

Returns the y-coordinate of the difference (end point - start point).

Definition at line 434 of file geometry.h.

 const DPoint& ogdf::DLine::end ( ) const
inline

Returns the end point of the line.

Definition at line 428 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.

Parameters:
 horAxis defines the horizontal line. crossing is assigned the x-coordinate of the intersection point.
Returns:
the number of intersection points (0 = none, 1 = one, 2 = this line lies on the horizontal line through y = horAxis).
 bool ogdf::DLine::intersection ( const DLine & line, DPoint & inter, bool endpoints = true ) const

Returns true iff line and this line intersect.

Parameters:
 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 446 of file geometry.h.

 bool ogdf::DLine::isVertical ( ) const
inline

Returns true iff this line runs vertically.

Definition at line 443 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 461 of file geometry.h.

 bool ogdf::DLine::operator!= ( const DLine & dl ) const
inline

Inequality operator.

Definition at line 411 of file geometry.h.

 DLine& ogdf::DLine::operator= ( const DLine & dl )
inline

Assignment operator.

Definition at line 416 of file geometry.h.

 bool ogdf::DLine::operator== ( const DLine & dl ) const
inline

Equality operator.

Definition at line 406 of file geometry.h.

 double ogdf::DLine::slope ( ) const
inline

Returns the slope of the line.

Definition at line 437 of file geometry.h.

 const DPoint& ogdf::DLine::start ( ) const
inline

Returns the start point of the line.

Definition at line 425 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.

Parameters:
 verAxis defines the vertical line. crossing is assigned the y-coordinate of the intersection point.
Returns:
the number of intersection points (0 = none, 1 = one, 2 = this line lies on the vertical line through x = verAxis).
 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 440 of file geometry.h.

## Member Data Documentation

 DPoint ogdf::DLine::m_end
protected

The end point of the line.

Definition at line 387 of file geometry.h.

 DPoint ogdf::DLine::m_start
protected

The start point of the line.

Definition at line 386 of file geometry.h.

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