Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

ogdf::DPolygon Class Reference

Polygons with real coordinates. More...

#include <ogdf/basic/geometry.h>

+ Inheritance diagram for ogdf::DPolygon:

Public Member Functions

 DPolygon (bool cc=true)
 Creates an empty polygon. More...
 
 DPolygon (const DPolygon &dop)
 Copy constructor. More...
 
 DPolygon (const DRect &rect, bool cc=true)
 Creates a polgon from a rectangle. More...
 
bool containsPoint (DPoint &p) const
 Checks whether a Point /a p is inside the Polygon or not. More...
 
bool counterclock ()
 Returns true iff points are given in counter-clockwise order. More...
 
int getCrossPoints (const DPolygon &p, List< DPoint > &crossPoints) const
 Returns the list of intersection points of this polygon with p. More...
 
void insertCrossPoint (const DPoint &p)
 Inserts point p on every segment (a,b) with p in the open range ]a, b[. More...
 
ListIterator< DPointinsertPoint (const DPoint &p)
 Inserts point p, that must lie on a polygon segment. More...
 
ListIterator< DPointinsertPoint (const DPoint &p, ListIterator< DPoint > p1, ListIterator< DPoint > p2)
 Inserts point p, but just searching from point p1 to p2. More...
 
void normalize ()
 Deletes all points, which are not facets. More...
 
DPolygonoperator= (const DPolygon &dop)
 Assignment operator. More...
 
DPolygonoperator= (const DRect &rect)
 Assignment operator (for assigning from a rectangle). More...
 
DSegment segment (ListConstIterator< DPoint > it) const
 Returns the line segment that starts at position it. More...
 
void unify ()
 Deletes all consecutive points that are equal. More...
 
- Public Member Functions inherited from ogdf::GenericPolyline< PointType >
 GenericPolyline ()
 Creates an empty polyline. More...
 
 GenericPolyline (const GenericPolyline< PointType > &pl)
 Copy constructor. More...
 
 GenericPolyline (const List< PointType > &pl)
 Creates a polyline using the list of points pl. More...
 
double length () const
 Returns the Euclidean length of the polyline. More...
 
void normalize (double minAngle=Math::pi)
 Deletes all redundant points on the polyline that lie on a (nearly) straight line given by their adjacent points. More...
 
void normalize (PointType src, PointType tgt, double minAngle=Math::pi)
 Deletes all redundant points on the polyline that lie on a (nearly) straight line given by their adjacent points. More...
 
GenericPolyline< PointType > & operator= (const GenericPolyline &pl)
 Assignment operator. More...
 
DPoint position (const double fraction, double len=-1.0) const
 Returns a point on the polyline which is fraction * len away from the start point. More...
 
void unify ()
 Deletes all successive points with equal coordinates. More...
 
- Public Member Functions inherited from ogdf::List< PointType >
 List ()
 Constructs an empty doubly linked list. More...
 
 List (const List< PointType > &L)
 Constructs a doubly linked list that is a copy of L. More...
 
 List (List< PointType > &&L) noexcept
 Constructs a doubly linked list containing the elements of L (move semantics). More...
 
 List (std::initializer_list< PointType > init)
 Constructs a doubly linked list containing the elements in init. More...
 
int size () const
 Returns the number of elements in the list. More...
 
const ListPure< PointType > & getListPure () const
 Conversion to const ListPure. More...
 
List< PointType > & operator= (const List< PointType > &L)
 Assignment operator. More...
 
List< PointType > & operator= (List< PointType > &&L)
 Assignment operator (move semantics). More...
 
bool operator== (const List< PointType > &L) const
 Equality operator. More...
 
bool operator!= (const List< PointType > &L) const
 Inequality operator. More...
 
iterator pushFront (const PointType &x)
 Adds element x at the beginning of the list. More...
 
iterator emplaceFront (Args &&... args)
 Adds a new element at the beginning of the list. More...
 
iterator pushBack (const PointType &x)
 Adds element x at the end of the list. More...
 
iterator emplaceBack (Args &&... args)
 Adds a new element at the end of the list. More...
 
iterator insert (const PointType &x, iterator it, Direction dir=Direction::after)
 Inserts element x before or after it. More...
 
iterator insertBefore (const PointType &x, iterator it)
 Inserts element x before it. More...
 
iterator insertAfter (const PointType &x, iterator it)
 Inserts element x after it. More...
 
void popFront ()
 Removes the first element from the list. More...
 
PointType popFrontRet ()
 Removes the first element from the list and returns it. More...
 
void popBack ()
 Removes the last element from the list. More...
 
PointType popBackRet ()
 Removes the last element from the list and returns it. More...
 
void del (iterator it)
 Removes it from the list. More...
 
bool removeFirst (const PointType &x)
 Removes the first occurrence of x (if any) from the list. More...
 
void clear ()
 Removes all elements from the list. More...
 
void moveToFront (iterator it, List< PointType > &L2)
 Moves it to the begin of the list. More...
 
void moveToBack (iterator it, List< PointType > &L2)
 Moves it to the end of the list. More...
 
void moveToSucc (iterator it, List< PointType > &L2, iterator itBefore)
 Moves it after itBefore. More...
 
void moveToPrec (iterator it, List< PointType > &L2, iterator itAfter)
 Moves it before itAfter. More...
 
void conc (List< PointType > &L2)
 Appends L2 to this list and makes L2 empty. More...
 
void concFront (List< PointType > &L2)
 Prepends L2 to this list and makes L2 empty. More...
 
void swap (List< PointType > &other)
 Exchanges the contents of this list and other in constant time. More...
 
void split (iterator it, List< PointType > &L1, List< PointType > &L2, Direction dir=Direction::before)
 Splits the list at element it into lists L1 and L2. More...
 

Protected Attributes

bool m_counterclock
 If true points are given in conter-clockwise order. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ogdf::GenericPolyline< PointType >
void normalizeUnified (double minAngle)
 Deletes all redundant points on the polyline that lie on a (nearly) straight line given by their adjacent points. More...
 

Detailed Description

Polygons with real coordinates.

Definition at line 989 of file geometry.h.

Constructor & Destructor Documentation

◆ DPolygon() [1/3]

ogdf::DPolygon::DPolygon ( bool  cc = true)
inline

Creates an empty polygon.

Parameters
ccdetermines in which order the points will be given; true means counter-clockwise, false means clockwise.

Definition at line 1000 of file geometry.h.

◆ DPolygon() [2/3]

ogdf::DPolygon::DPolygon ( const DRect rect,
bool  cc = true 
)
inlineexplicit

Creates a polgon from a rectangle.

Definition at line 1003 of file geometry.h.

◆ DPolygon() [3/3]

ogdf::DPolygon::DPolygon ( const DPolygon dop)
inline

Copy constructor.

Definition at line 1006 of file geometry.h.

Member Function Documentation

◆ containsPoint()

bool ogdf::DPolygon::containsPoint ( DPoint p) const

Checks whether a Point /a p is inside the Polygon or not.

Note
Polygons with crossings have inner areas that count as outside!
p the Point to check.
return true if Point is inside.

◆ counterclock()

bool ogdf::DPolygon::counterclock ( )
inline

Returns true iff points are given in counter-clockwise order.

Definition at line 1009 of file geometry.h.

◆ getCrossPoints()

int ogdf::DPolygon::getCrossPoints ( const DPolygon p,
List< DPoint > &  crossPoints 
) const

Returns the list of intersection points of this polygon with p.

◆ insertCrossPoint()

void ogdf::DPolygon::insertCrossPoint ( const DPoint p)

Inserts point p on every segment (a,b) with p in the open range ]a, b[.

◆ insertPoint() [1/2]

ListIterator<DPoint> ogdf::DPolygon::insertPoint ( const DPoint p)
inline

Inserts point p, that must lie on a polygon segment.

Definition at line 1025 of file geometry.h.

◆ insertPoint() [2/2]

ListIterator<DPoint> ogdf::DPolygon::insertPoint ( const DPoint p,
ListIterator< DPoint p1,
ListIterator< DPoint p2 
)

Inserts point p, but just searching from point p1 to p2.

That is, from the segment starting at p1 to the segment ending at p2.

◆ normalize()

void ogdf::DPolygon::normalize ( )

Deletes all points, which are not facets.

◆ operator=() [1/2]

DPolygon& ogdf::DPolygon::operator= ( const DPolygon dop)
inline

Assignment operator.

Definition at line 1012 of file geometry.h.

◆ operator=() [2/2]

DPolygon& ogdf::DPolygon::operator= ( const DRect rect)

Assignment operator (for assigning from a rectangle).

◆ segment()

DSegment ogdf::DPolygon::segment ( ListConstIterator< DPoint it) const

Returns the line segment that starts at position it.

◆ unify()

void ogdf::DPolygon::unify ( )

Deletes all consecutive points that are equal.

Member Data Documentation

◆ m_counterclock

bool ogdf::DPolygon::m_counterclock
protected

If true points are given in conter-clockwise order.

Definition at line 991 of file geometry.h.


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