Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

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

Protected Attributes

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

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.
 

Detailed Description

Polygons with real coordinates.

Definition at line 981 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 992 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 995 of file geometry.h.

◆ DPolygon() [3/3]

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

Copy constructor.

Definition at line 998 of file geometry.h.

Member Function Documentation

◆ containsPoint()

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

Checks wether a Point /a p is inside the Poylgon 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 1001 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 1017 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 1004 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 983 of file geometry.h.


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