Open
Graph Drawing
Framework

 v.2010.10
 

Public Member Functions | Protected Attributes

ogdf::DLine Class Reference

Lines with real coordinates. More...

#include <ogdf/basic/geometry.h>

Inheritance diagram for ogdf::DLine:
ogdf::DSegment

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 operator== (const DLine &dl) const
 Equality operator.
bool operator!= (const DLine &dl) const
 Inequality operator.
DLineoperator= (const DLine &dl)
 Assignment operator.
const DPointstart () const
 Returns the start point of the line.
const DPointend () 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.

Detailed Description

Lines with real coordinates.

Definition at line 388 of file geometry.h.


Constructor & Destructor Documentation

ogdf::DLine::DLine (  )  [inline]

Creates an empty line.

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


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 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.

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 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.

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

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.

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


Member Data Documentation

The end point of the line.

Definition at line 392 of file geometry.h.

The start point of the line.

Definition at line 391 of file geometry.h.


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