Polylines with PointType points. More...
#include <ogdf/basic/geometry.h>
Public Member Functions | |
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 Member Functions | |
void | normalizeUnified (double minAngle) |
Deletes all redundant points on the polyline that lie on a (nearly) straight line given by their adjacent points. More... | |
Polylines with PointType points.
This class represents polylines by a list of PointType points. Such polylines are, e.g., used in layouts for representing bend point lists. Note that in this case, only the bend points are in the list and neither the start nor the end point.
Definition at line 261 of file geometry.h.
|
inline |
Creates an empty polyline.
Definition at line 264 of file geometry.h.
|
inline |
Creates a polyline using the list of points pl
.
Definition at line 267 of file geometry.h.
|
inline |
Copy constructor.
Definition at line 270 of file geometry.h.
|
inline |
Returns the Euclidean length of the polyline.
Definition at line 279 of file geometry.h.
|
inline |
Deletes all redundant points on the polyline that lie on a (nearly) straight line given by their adjacent points.
How straight the line has to be depends on minAngle
. If this parameter is omitted, only points on completely straight lines are removed.
In each iteration look at three points of the polyline, the middle one being a candidate for deletion. If it is deleted, advance in the polyline by one point. If it is not deleted, go back in the polyline by one point (the deletion might have lead to a greater angle between the points before and behind the deleted one). Repeat this process until the end of the polyline is reached.
minAngle | in [0..Pi] is a lower bound for the smaller angle between two line segments such that the Point between them is still removed. |
Definition at line 428 of file geometry.h.
|
inline |
Deletes all redundant points on the polyline that lie on a (nearly) straight line given by their adjacent points.
How straight the line has to be depends on minAngle
. If this parameter is omitted, only points on completely straight lines are removed.
In each iteration look at three points of the polyline, the middle one being a candidate for deletion. If it is deleted, advance in the polyline by one point. If it is not deleted, go back in the polyline by one point (the deletion might have lead to a greater angle between the points before and behind the deleted one). Repeat this process until the end of the polyline is reached.
minAngle | in [0..Pi] is a lower bound for the smaller angle between two line segments such that the Point between them is still removed. |
src | is used as a point that comes before all points in this polyline. |
tgt | is used as a point that comes after all points in this polyline. |
Definition at line 438 of file geometry.h.
|
inlineprotected |
Deletes all redundant points on the polyline that lie on a (nearly) straight line given by their adjacent points.
How straight the line has to be depends on minAngle
. If this parameter is omitted, only points on completely straight lines are removed.
In each iteration look at three points of the polyline, the middle one being a candidate for deletion. If it is deleted, advance in the polyline by one point. If it is not deleted, go back in the polyline by one point (the deletion might have lead to a greater angle between the points before and behind the deleted one). Repeat this process until the end of the polyline is reached.
minAngle | in [0..Pi] is a lower bound for the smaller angle between two line segments such that the Point between them is still removed. |
Definition at line 378 of file geometry.h.
|
inline |
Assignment operator.
Definition at line 273 of file geometry.h.
|
inline |
Returns a point on the polyline which is fraction
* len
away from the start point.
fraction | defines the fraction of len to be considered. |
len | is the given length, or the length of the polyline if len < 0. |
Definition at line 304 of file geometry.h.
|
inline |
Deletes all successive points with equal coordinates.
Definition at line 357 of file geometry.h.