Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

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

Protected Member Functions

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

Protected Attributes

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

Detailed Description

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

Infinite lines.

Definition at line 448 of file geometry.h.

Member Typedef Documentation

◆ numberType

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

Definition at line 450 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 464 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 467 of file geometry.h.

◆ GenericLine() [3/4]

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

Copy constructor.

Definition at line 470 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 473 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 552 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 516 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 457 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 460 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 580 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 528 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 498 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 495 of file geometry.h.

◆ operator!=()

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

Inequality operator.

Definition at line 483 of file geometry.h.

◆ operator=()

Assignment operator.

Definition at line 486 of file geometry.h.

◆ operator==()

Equality operator.

Definition at line 477 of file geometry.h.

◆ slope()

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

Returns the slope of the line.

Definition at line 501 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 597 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 505 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 453 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 454 of file geometry.h.


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