Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

ogdf::DLine Class Reference

Lines with real coordinates. More...

#include <ogdf/basic/geometry.h>

+ Inheritance diagram for ogdf::DLine:

Public Member Functions

 DLine ()
 Creates an empty line. More...
 
 DLine (const DPoint &p1, const DPoint &p2)
 Creates a line with start point p1 and end point p2. More...
 
 DLine (const DLine &dl)
 Copy constructor. More...
 
 DLine (double x1, double y1, double x2, double y2)
 Creates a line with start point (x1,y1) and end point (x2,y2). More...
 
bool contains (const DPoint &p) const
 Returns true iff p lie on this line. More...
 
double dx () const
 Returns the x-coordinate of the difference (end point - start point). More...
 
double dy () const
 Returns the y-coordinate of the difference (end point - start point). More...
 
const DPoint & end () const
 Returns the end point of the line. More...
 
int horIntersection (const double horAxis, double &crossing) const
 Computes the intersection between this line and the horizontal line through y = horAxis. More...
 
bool intersection (const DLine &line, DPoint &inter, bool endpoints=true) const
 Returns true iff line and this line intersect. More...
 
bool intersectionOfLines (const DLine &line, DPoint &inter) const
 
bool isHorizontal () const
 Returns true iff this line runs horizontally. More...
 
bool isVertical () const
 Returns true iff this line runs vertically. More...
 
double length () const
 Returns the length (euclidean distance between start and edn point) of this line. More...
 
bool operator!= (const DLine &dl) const
 Inequality operator. More...
 
DLine & operator= (const DLine &dl)
 Assignment operator. More...
 
bool operator== (const DLine &dl) const
 Equality operator. More...
 
double slope () const
 Returns the slope of the line. More...
 
const DPoint & start () const
 Returns the start point of the line. More...
 
int verIntersection (const double verAxis, double &crossing) const
 Computes the intersection between this line and the vertical line through x = verAxis. More...
 
double yAbs () const
 Returns the value y' such that (0,y') lies on the unlimited straight-line define dby this line. More...
 

Protected Attributes

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

Detailed Description

Lines with real coordinates.

Definition at line 399 of file geometry.h.

Constructor & Destructor Documentation

◆ DLine() [1/4]

ogdf::DLine::DLine ( )
inline

Creates an empty line.

Definition at line 408 of file geometry.h.

◆ DLine() [2/4]

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

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

Definition at line 411 of file geometry.h.

◆ DLine() [3/4]

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

Copy constructor.

Definition at line 414 of file geometry.h.

◆ DLine() [4/4]

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

Member Function Documentation

◆ contains()

bool ogdf::DLine::contains ( const DPoint &  p) const

Returns true iff p lie on this line.

◆ dx()

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

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

Definition at line 447 of file geometry.h.

◆ dy()

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

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

Definition at line 450 of file geometry.h.

◆ end()

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

Returns the end point of the line.

Definition at line 444 of file geometry.h.

◆ horIntersection()

int ogdf::DLine::horIntersection ( const double  horAxis,
double &  crossing 
) const

Computes the intersection between this line and the horizontal line through y = horAxis.

Parameters
horAxisdefines the horizontal line.
crossingis 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).

◆ intersection()

bool ogdf::DLine::intersection ( const DLine &  line,
DPoint &  inter,
bool  endpoints = true 
) const

Returns true iff line and this line intersect.

Parameters
lineis the second line.
interis assigned the intersection point if true is returned.
endpointsdetermines if common endpoints are treated as intersection.

◆ intersectionOfLines()

bool ogdf::DLine::intersectionOfLines ( const DLine &  line,
DPoint &  inter 
) const

◆ isHorizontal()

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

Returns true iff this line runs horizontally.

Definition at line 462 of file geometry.h.

◆ isVertical()

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

Returns true iff this line runs vertically.

Definition at line 459 of file geometry.h.

◆ length()

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

Returns the length (euclidean distance between start and edn point) of this line.

Definition at line 479 of file geometry.h.

◆ operator!=()

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

Inequality operator.

Definition at line 427 of file geometry.h.

◆ operator=()

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

Assignment operator.

Definition at line 432 of file geometry.h.

◆ operator==()

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

Equality operator.

Definition at line 422 of file geometry.h.

◆ slope()

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

Returns the slope of the line.

Definition at line 453 of file geometry.h.

◆ start()

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

Returns the start point of the line.

Definition at line 441 of file geometry.h.

◆ verIntersection()

int ogdf::DLine::verIntersection ( const double  verAxis,
double &  crossing 
) const

Computes the intersection between this line and the vertical line through x = verAxis.

Parameters
verAxisdefines the vertical line.
crossingis 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).

◆ yAbs()

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

Member Data Documentation

◆ m_end

DPoint ogdf::DLine::m_end
protected

The end point of the line.

Definition at line 403 of file geometry.h.

◆ m_start

DPoint ogdf::DLine::m_start
protected

The start point of the line.

Definition at line 402 of file geometry.h.


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