Open
Graph Drawing
Framework

 v. 2022.02 (Dogwood)
 

ogdf::GenericLine< PointType > Class Template Reference

Infinite lines. More...

#include <ogdf/basic/geometry.h>

+ Inheritance diagram for ogdf::GenericLine< PointType >:

Public Types

using numberType = typename PointType::numberType
 

Public Member Functions

 GenericLine ()
 Creates an empty line. More...
 
 GenericLine (const GenericLine< PointType > &dl)
 Copy constructor. More...
 
 GenericLine (const PointType &p1, const PointType &p2)
 Creates a line through the points p1 and p2. More...
 
 GenericLine (numberType x1, numberType y1, numberType x2, numberType y2)
 Creates a line through the points (x1,y1) and (x2,y2). More...
 
virtual bool contains (const DPoint &p) const
 Returns true iff p lies on this line. More...
 
double det (const GenericLine< PointType > &line) const
 Determines if line is left or right of this line. More...
 
virtual IntersectionType horIntersection (const double horAxis, double &crossing) const
 Computes the intersection of this line and the horizontal line through y = horAxis. More...
 
IntersectionType intersection (const GenericLine< PointType > &line, DPoint &inter) const
 Returns an IntersectionType specifying whether line and this line intersect. More...
 
bool isHorizontal () const
 Returns true iff this line runs horizontally. More...
 
bool isVertical () const
 Returns true iff this line runs vertically. More...
 
bool operator!= (const GenericLine< PointType > &dl) const
 Inequality operator. More...
 
GenericLine< PointType > & operator= (const GenericLine< PointType > &dl)
 Assignment operator. More...
 
bool operator== (const GenericLine< PointType > &dl) const
 Equality operator. More...
 
double slope () const
 Returns the slope of the line. More...
 
virtual IntersectionType 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 defined by this line. More...
 

Protected Member Functions

numberType dx () const
 Returns the x-coordinate of the difference (second point - first point). More...
 
numberType dy () const
 Returns the y-coordinate of the difference (second point - first point). More...
 

Protected Attributes

PointType m_p1
 The first point of the line. More...
 
PointType m_p2
 The second point of the line. More...
 

Detailed Description

template<class PointType>
class ogdf::GenericLine< PointType >

Infinite lines.

Definition at line 446 of file geometry.h.

Member Typedef Documentation

◆ numberType

template<class PointType >
using ogdf::GenericLine< PointType >::numberType = typename PointType::numberType

Definition at line 449 of file geometry.h.

Constructor & Destructor Documentation

◆ GenericLine() [1/4]

template<class PointType >
ogdf::GenericLine< PointType >::GenericLine ( )
inline

Creates an empty line.

Definition at line 463 of file geometry.h.

◆ GenericLine() [2/4]

template<class PointType >
ogdf::GenericLine< PointType >::GenericLine ( const PointType &  p1,
const PointType &  p2 
)
inline

Creates a line through the points p1 and p2.

Definition at line 466 of file geometry.h.

◆ GenericLine() [3/4]

template<class PointType >
ogdf::GenericLine< PointType >::GenericLine ( const GenericLine< PointType > &  dl)
inline

Copy constructor.

Definition at line 469 of file geometry.h.

◆ GenericLine() [4/4]

template<class PointType >
ogdf::GenericLine< PointType >::GenericLine ( numberType  x1,
numberType  y1,
numberType  x2,
numberType  y2 
)
inline

Creates a line through the points (x1,y1) and (x2,y2).

Definition at line 472 of file geometry.h.

Member Function Documentation

◆ contains()

template<class PointType >
virtual bool ogdf::GenericLine< PointType >::contains ( const DPoint p) const
inlinevirtual

Returns true iff p lies on this line.

Definition at line 555 of file geometry.h.

◆ det()

template<class PointType >
double ogdf::GenericLine< PointType >::det ( const GenericLine< PointType > &  line) const
inline

Determines if line is left or right of this line.

Parameters
lineis the second line.
Returns
a positive number if line is left of this line, and a negative number if line is right of this line.

Definition at line 519 of file geometry.h.

◆ dx()

template<class PointType >
numberType ogdf::GenericLine< PointType >::dx ( ) const
inlineprotected

Returns the x-coordinate of the difference (second point - first point).

Definition at line 456 of file geometry.h.

◆ dy()

template<class PointType >
numberType ogdf::GenericLine< PointType >::dy ( ) const
inlineprotected

Returns the y-coordinate of the difference (second point - first point).

Definition at line 459 of file geometry.h.

◆ horIntersection()

template<class PointType >
virtual IntersectionType ogdf::GenericLine< PointType >::horIntersection ( const double  horAxis,
double &  crossing 
) const
inlinevirtual

Computes the intersection of 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 IntersectionType of the intersection between this line and horAxis.

Reimplemented in ogdf::GenericSegment< PointType >.

Definition at line 584 of file geometry.h.

◆ intersection()

template<class PointType >
IntersectionType ogdf::GenericLine< PointType >::intersection ( const GenericLine< PointType > &  line,
DPoint inter 
) const
inline

Returns an IntersectionType specifying whether line and this line intersect.

Parameters
lineis the second line.
interis assigned an intersection point if IntersectionType::SinglePoint or IntersectionType::Overlapping is returned.

Definition at line 531 of file geometry.h.

◆ isHorizontal()

template<class PointType >
bool ogdf::GenericLine< PointType >::isHorizontal ( ) const
inline

Returns true iff this line runs horizontally.

Definition at line 499 of file geometry.h.

◆ isVertical()

template<class PointType >
bool ogdf::GenericLine< PointType >::isVertical ( ) const
inline

Returns true iff this line runs vertically.

Definition at line 496 of file geometry.h.

◆ operator!=()

template<class PointType >
bool ogdf::GenericLine< PointType >::operator!= ( const GenericLine< PointType > &  dl) const
inline

Inequality operator.

Definition at line 482 of file geometry.h.

◆ operator=()

template<class PointType >
GenericLine<PointType>& ogdf::GenericLine< PointType >::operator= ( const GenericLine< PointType > &  dl)
inline

Assignment operator.

Definition at line 487 of file geometry.h.

◆ operator==()

template<class PointType >
bool ogdf::GenericLine< PointType >::operator== ( const GenericLine< PointType > &  dl) const
inline

Equality operator.

Definition at line 476 of file geometry.h.

◆ slope()

template<class PointType >
double ogdf::GenericLine< PointType >::slope ( ) const
inline

Returns the slope of the line.

Definition at line 502 of file geometry.h.

◆ verIntersection()

template<class PointType >
virtual IntersectionType ogdf::GenericLine< PointType >::verIntersection ( const double  verAxis,
double &  crossing 
) const
inlinevirtual

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 IntersectionType of the intersection between this line and verAxis.

Reimplemented in ogdf::GenericSegment< PointType >.

Definition at line 602 of file geometry.h.

◆ yAbs()

template<class PointType >
double ogdf::GenericLine< PointType >::yAbs ( ) const
inline

Returns the value y' such that (0,y') lies on the unlimited straight-line defined by this line.

Definition at line 508 of file geometry.h.

Member Data Documentation

◆ m_p1

template<class PointType >
PointType ogdf::GenericLine< PointType >::m_p1
protected

The first point of the line.

Definition at line 452 of file geometry.h.

◆ m_p2

template<class PointType >
PointType ogdf::GenericLine< PointType >::m_p2
protected

The second point of the line.

Definition at line 453 of file geometry.h.


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