Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

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 DRect &rect, bool cc=true)
 Creates a polgon from a rectangle. More...
 
 DPolygon (const DPolygon &dop)
 Copy constructor. More...
 
bool containsPoint (DPoint &p) const
 Checks wether a Point /a p is inside the Poylgon 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< DPoint > insertPoint (const DPoint &p)
 Inserts point p, that must lie on a polygon segment. More...
 
ListIterator< DPoint > insertPoint (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...
 
DPolygon & operator= (const DPolygon &dop)
 Assignment operator. More...
 
DPolygon & operator= (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::DPolyline
 DPolyline ()
 Creates an empty integer polyline. More...
 
 DPolyline (const DPolyline &dpl)
 Copy constructor. More...
 
void convertToInt ()
 Converts all coordinates rounded to s_prec decimal digits. More...
 
double length () const
 Returns the euclidean length of the polyline. More...
 
void normalize ()
 Deletes all redundant points on the polyline that lie on a straight line given by their adajcent points. More...
 
void normalize (DPoint src, DPoint tgt)
 Deletes all redundant points on the polyline that lie on a straight line given by their adajcent points. More...
 
DPolyline & operator= (const DPolyline &dpl)
 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< DPoint >
 List ()
 Constructs an empty doubly linked list. More...
 
 List (std::initializer_list< DPoint > init)
 Constructs a doubly linked list containing the elements in init. More...
 
 List (const List< DPoint > &L)
 Constructs a doubly linked list that is a copy of L. More...
 
 List (List< DPoint > &&L)
 Constructs a doubly linked list containing the elements of L (move semantics). More...
 
int size () const
 Returns the number of elements in the list. More...
 
const ListPure< DPoint > & getListPure () const
 Conversion to const ListPure. More...
 
List< DPoint > & operator= (const List< DPoint > &L)
 Assignment operator. More...
 
List< DPoint > & operator= (List< DPoint > &&L)
 Assignment operator (move semantics). More...
 
bool operator== (const List< DPoint > &L) const
 
bool operator!= (const List< DPoint > &L) const
 
iterator pushFront (const DPoint &x)
 
iterator emplaceFront (Args &&... args)
 
iterator pushBack (const DPoint &x)
 
iterator emplaceBack (Args &&... args)
 
iterator insert (const DPoint &x, iterator it, Direction dir=Direction::after)
 
iterator insertBefore (const DPoint &x, iterator it)
 
iterator insertAfter (const DPoint &x, iterator it)
 
void popFront ()
 
DPoint popFrontRet ()
 
void popBack ()
 
DPoint popBackRet ()
 
void del (iterator it)
 
bool removeFirst (const DPoint &x)
 
void clear ()
 
void moveToFront (iterator it, List< DPoint > &L2)
 
void moveToBack (iterator it, List< DPoint > &L2)
 
void moveToSucc (iterator it, List< DPoint > &L2, iterator itBefore)
 
void moveToPrec (iterator it, List< DPoint > &L2, iterator itAfter)
 
void conc (List< DPoint > &L2)
 
void concFront (List< DPoint > &L2)
 
void swap (List< DPoint > &other)
 
void split (iterator it, List< DPoint > &L1, List< DPoint > &L2, Direction dir=Direction::before)
 

Protected Attributes

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

Detailed Description

Polygons with real coordinates.

Definition at line 815 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 828 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 831 of file geometry.h.

◆ DPolygon() [3/3]

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

Copy constructor.

Definition at line 836 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 839 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 856 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 842 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 819 of file geometry.h.


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