Classes | Public Member Functions | Private Types | Private Member Functions | List of all members
psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator > Class Template Reference

Provides various simplification algorithms for n-dimensional simple polylines. More...

#include <psimpl.h>

Classes

class  DPHelper
 Douglas-Peucker approximation helper class. More...
 

Public Member Functions

OutputIterator ComputePositionalErrors2 (InputIterator original_first, InputIterator original_last, InputIterator simplified_first, InputIterator simplified_last, OutputIterator result, bool *valid=0)
 Computes the squared positional error between a polyline and its simplification. More...
 
math::Statistics ComputePositionalErrorStatistics (InputIterator original_first, InputIterator original_last, InputIterator simplified_first, InputIterator simplified_last, bool *valid=0)
 Computes statistics for the positional errors between a polyline and its simplification. More...
 
OutputIterator DouglasPeucker (InputIterator first, InputIterator last, value_type tol, OutputIterator result)
 Performs Douglas-Peucker approximation (DP). More...
 
OutputIterator DouglasPeuckerN (InputIterator first, InputIterator last, unsigned count, OutputIterator result)
 Performs a Douglas-Peucker approximation variant (DPn). More...
 
OutputIterator Lang (InputIterator first, InputIterator last, value_type tol, unsigned look_ahead, OutputIterator result)
 Performs Lang approximation (LA). More...
 
OutputIterator NthPoint (InputIterator first, InputIterator last, unsigned n, OutputIterator result)
 Performs the nth point routine (NP). More...
 
OutputIterator Opheim (InputIterator first, InputIterator last, value_type min_tol, value_type max_tol, OutputIterator result)
 Performs Opheim approximation (OP). More...
 
OutputIterator PerpendicularDistance (InputIterator first, InputIterator last, value_type tol, OutputIterator result)
 Performs the perpendicular distance routine (PD). More...
 
OutputIterator PerpendicularDistance (InputIterator first, InputIterator last, value_type tol, unsigned repeat, OutputIterator result)
 Repeatedly performs the perpendicular distance routine (PD). More...
 
OutputIterator RadialDistance (InputIterator first, InputIterator last, value_type tol, OutputIterator result)
 Performs the (radial) distance between points routine (RD). More...
 
OutputIterator ReumannWitkam (InputIterator first, InputIterator last, value_type tol, OutputIterator result)
 Performs Reumann-Witkam approximation (RW). More...
 

Private Types

typedef std::iterator_traits< InputIterator >::difference_type diff_type
 
typedef std::iterator_traits< const value_type * >::difference_type ptr_diff_type
 
typedef std::iterator_traits< InputIterator >::value_type value_type
 

Private Member Functions

void Advance (InputIterator &it, diff_type n=1)
 Increments the iterator by n points. More...
 
InputIterator AdvanceCopy (InputIterator it, diff_type n=1)
 Increments a copy of the iterator by n points. More...
 
void Backward (InputIterator &it, unsigned &remaining)
 Decrements the iterator by 1 point. More...
 
void CopyKey (InputIterator key, OutputIterator &result)
 Copies the key to the output destination. More...
 
void CopyKeyAdvance (InputIterator &key, OutputIterator &result)
 Copies the key to the output destination, and increments the iterator. More...
 
unsigned Forward (InputIterator &it, unsigned n, unsigned &remaining)
 Increments the iterator by n points if possible. More...
 

Detailed Description

template<unsigned DIM, class InputIterator, class OutputIterator>
class psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >

Provides various simplification algorithms for n-dimensional simple polylines.

A polyline is simple when it is non-closed and non-selfintersecting. All algorithms operate on input iterators and output iterators. Note that unisgned integer types are NOT supported.

Definition at line 454 of file psimpl.h.

Member Typedef Documentation

◆ diff_type

template<unsigned DIM, class InputIterator , class OutputIterator >
typedef std::iterator_traits<InputIterator>::difference_type psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >::diff_type
private

Definition at line 456 of file psimpl.h.

◆ ptr_diff_type

template<unsigned DIM, class InputIterator , class OutputIterator >
typedef std::iterator_traits<const value_type*>::difference_type psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >::ptr_diff_type
private

Definition at line 458 of file psimpl.h.

◆ value_type

template<unsigned DIM, class InputIterator , class OutputIterator >
typedef std::iterator_traits<InputIterator>::value_type psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >::value_type
private

Definition at line 457 of file psimpl.h.

Member Function Documentation

◆ Advance()

template<unsigned DIM, class InputIterator , class OutputIterator >
void psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >::Advance ( InputIterator &  it,
diff_type  n = 1 
)
inlineprivate

Increments the iterator by n points.

See also
AdvanceCopy
Parameters
[in,out]ititerator to be advanced
[in]nnumber of points to advance

Definition at line 1385 of file psimpl.h.

◆ AdvanceCopy()

template<unsigned DIM, class InputIterator , class OutputIterator >
InputIterator psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >::AdvanceCopy ( InputIterator  it,
diff_type  n = 1 
)
inlineprivate

Increments a copy of the iterator by n points.

See also
Advance
Parameters
[in]ititerator to be advanced
[in]nnumber of points to advance
Returns
an incremented copy of the input iterator

Definition at line 1401 of file psimpl.h.

◆ Backward()

template<unsigned DIM, class InputIterator , class OutputIterator >
void psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >::Backward ( InputIterator &  it,
unsigned &  remaining 
)
inlineprivate

Decrements the iterator by 1 point.

See also
Forward
Parameters
[in,out]ititerator to be advanced
[in,out]remainingnumber of points remaining after it

Definition at line 1441 of file psimpl.h.

◆ ComputePositionalErrors2()

template<unsigned DIM, class InputIterator , class OutputIterator >
OutputIterator psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >::ComputePositionalErrors2 ( InputIterator  original_first,
InputIterator  original_last,
InputIterator  simplified_first,
InputIterator  simplified_last,
OutputIterator  result,
bool *  valid = 0 
)
inline

Computes the squared positional error between a polyline and its simplification.

For each point in the range [original_first, original_last) the squared distance to the simplification [simplified_first, simplified_last) is calculated. Each positional error is copied to the output range [result, result + count), where count is the number of points in the original polyline. The return value is the end of the output range: result + count.

Note that both the original and simplified polyline must be defined using the same value_type.

Input (Type) requirements: 1- DIM is not 0, where DIM represents the dimension of the polyline 2- The InputIterator type models the concept of a forward iterator 3- The InputIterator value type is convertible to a value type of the output iterator 4- The ranges [original_first, original_last) and [simplified_first, simplified_last) contain vertex coordinates in multiples of DIM, f.e.: x, y, z, x, y, z, x, y, z when DIM = 3 5- The ranges [original_first, original_last) and [simplified_first, simplified_last) contain a minimum of 2 vertices 6- The range [simplified_first, simplified_last) represents a simplification of the range [original_first, original_last), meaning each point in the simplification has the exact same coordinates as some point from the original polyline

In case these requirements are not met, the valid flag is set to false OR compile errors may occur.

Parameters
[in]original_firstthe first coordinate of the first polyline point
[in]original_lastone beyond the last coordinate of the last polyline point
[in]simplified_firstthe first coordinate of the first simplified polyline point
[in]simplified_lastone beyond the last coordinate of the last simplified polyline point
[in]resultdestination of the squared positional errors
[out]valid[optional] indicates if the computed positional errors are valid
Returns
one beyond the last computed positional error

Definition at line 1224 of file psimpl.h.

◆ ComputePositionalErrorStatistics()

template<unsigned DIM, class InputIterator , class OutputIterator >
math::Statistics psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >::ComputePositionalErrorStatistics ( InputIterator  original_first,
InputIterator  original_last,
InputIterator  simplified_first,
InputIterator  simplified_last,
bool *  valid = 0 
)
inline

Computes statistics for the positional errors between a polyline and its simplification.

Various statistics (mean, max, sum, std) are calculated for the positional errors between the range [original_first, original_last) and its simplification the range [simplified_first, simplified_last).

Input (Type) requirements: 1- DIM is not 0, where DIM represents the dimension of the polyline 2- The InputIterator type models the concept of a forward iterator 3- The InputIterator value type is convertible to double 4- The ranges [original_first, original_last) and [simplified_first, simplified_last) contain vertex coordinates in multiples of DIM, f.e.: x, y, z, x, y, z, x, y, z when DIM = 3 5- The ranges [original_first, original_last) and [simplified_first, simplified_last) contain a minimum of 2 vertices 6- The range [simplified_first, simplified_last) represents a simplification of the range [original_first, original_last), meaning each point in the simplification has the exact same coordinates as some point from the original polyline

In case these requirements are not met, the valid flag is set to false OR compile errors may occur.

See also
ComputePositionalErrors2
Parameters
[in]original_firstthe first coordinate of the first polyline point
[in]original_lastone beyond the last coordinate of the last polyline point
[in]simplified_firstthe first coordinate of the first simplified polyline point
[in]simplified_lastone beyond the last coordinate of the last simplified polyline point
[out]valid[optional] indicates if the computed statistics are valid
Returns
the computed statistics

Definition at line 1317 of file psimpl.h.

◆ CopyKey()

template<unsigned DIM, class InputIterator , class OutputIterator >
void psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >::CopyKey ( InputIterator  key,
OutputIterator &  result 
)
inlineprivate

Copies the key to the output destination.

See also
CopyKeyAdvance
Parameters
[in]keythe first coordinate of the key
[in,out]resultdestination of the copied key

Definition at line 1370 of file psimpl.h.

◆ CopyKeyAdvance()

template<unsigned DIM, class InputIterator , class OutputIterator >
void psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >::CopyKeyAdvance ( InputIterator &  key,
OutputIterator &  result 
)
inlineprivate

Copies the key to the output destination, and increments the iterator.

See also
CopyKey
Parameters
[in,out]keythe first coordinate of the key
[in,out]resultdestination of the copied key

Definition at line 1351 of file psimpl.h.

◆ DouglasPeucker()

template<unsigned DIM, class InputIterator , class OutputIterator >
OutputIterator psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >::DouglasPeucker ( InputIterator  first,
InputIterator  last,
value_type  tol,
OutputIterator  result 
)
inline

Performs Douglas-Peucker approximation (DP).

The DP algorithm uses the RadialDistance (RD) routine O(n) as a preprocessing step. After RD the algorithm is O (n m) in worst case and O(n log m) on average, where m < n (m is the number of points after RD).

The DP algorithm starts with a simplification that is the single edge joining the first and last vertices of the polyline. The distance of the remaining vertices to that edge are computed. The vertex that is furthest away from theedge (called a key), and has a computed distance that is larger than a specified tolerance, will be added to the simplification. This process will recurse for each edge in the current simplification, untill all vertices of the original polyline are within tolerance.

Note that this algorithm will create a copy of the input polyline during the vertex reduction step.

RD followed by DP is applied to the range [first, last) using the specified tolerance tol. The resulting simplified polyline is copied to the output range [result, result + m*DIM), where m is the number of vertices of the simplified polyline. The return value is the end of the output range: result + m*DIM.

Input (Type) requirements: 1- DIM is not 0, where DIM represents the dimension of the polyline 2- The InputIterator type models the concept of a forward iterator 3- The InputIterator value type is convertible to a value type of the output iterator 4- The range [first, last) contains vertex coordinates in multiples of DIM, f.e.: x, y, z, x, y, z, x, y, z when DIM = 3 5- The range [first, last) contains at least 2 vertices 6- tol is not 0

In case these requirements are not met, the entire input range [first, last) is copied to the output range [result, result + (last - first)) OR compile errors may occur.

Parameters
[in]firstthe first coordinate of the first polyline point
[in]lastone beyond the last coordinate of the last polyline point
[in]tolperpendicular (point-to-segment) distance tolerance
[in]resultdestination of the simplified polyline
Returns
one beyond the last coordinate of the simplified polyline

Definition at line 1070 of file psimpl.h.

◆ DouglasPeuckerN()

template<unsigned DIM, class InputIterator , class OutputIterator >
OutputIterator psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >::DouglasPeuckerN ( InputIterator  first,
InputIterator  last,
unsigned  count,
OutputIterator  result 
)
inline

Performs a Douglas-Peucker approximation variant (DPn).

This algorithm is a variation of the original implementation. Instead of considering one polyline segment at a time, all segments of the current simplified polyline are evaluated at each step. Only the vertex with the maximum distance from its edge is added to the simplification. This process will recurse untill the the simplification contains the desired amount of vertices.

The algorithm, which does not use the (radial) distance between points routine as a preprocessing step, is O(n2) in worst case and O(n log n) on average.

Note that this algorithm will create a copy of the input polyline for performance reasons.

DPn is applied to the range [first, last). The resulting simplified polyline consists of count vertices and is copied to the output range [result, result + count). The return value is the end of the output range: result + count.

Input (Type) requirements: 1- DIM is not 0, where DIM represents the dimension of the polyline 2- The InputIterator type models the concept of a forward iterator 3- The InputIterator value type is convertible to a value type of the output iterator 4- The range [first, last) contains vertex coordinates in multiples of DIM, f.e.: x, y, z, x, y, z, x, y, z when DIM = 3 5- The range [first, last) contains a minimum of count vertices 6- count is at least 2

In case these requirements are not met, the entire input range [first, last) is copied to the output range [result, result + (last - first)) OR compile errors may occur.

See also
DouglasPeucker
Parameters
[in]firstthe first coordinate of the first polyline point
[in]lastone beyond the last coordinate of the last polyline point
[in]countthe maximum number of points of the simplified polyline
[in]resultdestination of the simplified polyline
Returns
one beyond the last coordinate of the simplified polyline

Definition at line 1147 of file psimpl.h.

◆ Forward()

template<unsigned DIM, class InputIterator , class OutputIterator >
unsigned psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >::Forward ( InputIterator &  it,
unsigned  n,
unsigned &  remaining 
)
inlineprivate

Increments the iterator by n points if possible.

If there are fewer than n point remaining the iterator will be incremented to the last point.

See also
Backward
Parameters
[in,out]ititerator to be advanced
[in]nnumber of points to advance
[in,out]remainingnumber of points remaining after it
Returns
the actual amount of points that the iterator advanced

Definition at line 1422 of file psimpl.h.

◆ Lang()

template<unsigned DIM, class InputIterator , class OutputIterator >
OutputIterator psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >::Lang ( InputIterator  first,
InputIterator  last,
value_type  tol,
unsigned  look_ahead,
OutputIterator  result 
)
inline

Performs Lang approximation (LA).

The LA routine defines a fixed size search-region. The first and last points of that search region form a segment. This segment is used to calculate the perpendicular distance to each intermediate point. If any calculated distance is larger than the specified tolerance, the search region will be shrunk by excluding its last point. This process will continue untill all calculated distances fall below the specified tolerance , or there are no more intermediate points. At this point all intermediate points are removed and a new search region is defined starting at the last point from old search region. Note that the size of the search region (look_ahead parameter) controls the maximum amount of simplification, e.g.: a size of 20 will always result in a simplification that contains at least 5% of the original points.

LA routine is applied to the range [first, last) using the specified tolerance and look ahead values. The resulting simplified polyline is copied to the output range [result, result + m*DIM), where m is the number of vertices of the simplified polyline. The return value is the end of the output range: result + m*DIM.

Input (Type) Requirements: 1- DIM is not 0, where DIM represents the dimension of the polyline 2- The InputIterator type models the concept of a bidirectional iterator 3- The InputIterator value type is convertible to a value type of the output iterator 4- The range [first, last) contains vertex coordinates in multiples of DIM, f.e.: x, y, z, x, y, z, x, y, z when DIM = 3 5- The range [first, last) contains at least 2 vertices 6- tol is not 0 7- look_ahead is not zero

In case these requirements are not met, the entire input range [first, last) is copied to the output range [result, result + (last - first)) OR compile errors may occur.

Parameters
[in]firstthe first coordinate of the first polyline point
[in]lastone beyond the last coordinate of the last polyline point
[in]tolperpendicular (point-to-segment) distance tolerance
[in]look_aheaddefines the size of the search region
[in]resultdestination of the simplified polyline
Returns
one beyond the last coordinate of the simplified polyline

Definition at line 978 of file psimpl.h.

◆ NthPoint()

template<unsigned DIM, class InputIterator , class OutputIterator >
OutputIterator psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >::NthPoint ( InputIterator  first,
InputIterator  last,
unsigned  n,
OutputIterator  result 
)
inline

Performs the nth point routine (NP).

NP is an O(n) algorithm for polyline simplification. It keeps only the first, last and each nth point. As an example, consider any random line of 8 points. Using n = 3 will always yield a simplification consisting of points: 1, 4, 7, 8

NP is applied to the range [first, last). The resulting simplified polyline is copied to the output range [result, result + m*DIM), where m is the number of vertices of the simplified polyline. The return value is the end of the output range: result + m*DIM.

Input (Type) requirements: 1- DIM is not 0, where DIM represents the dimension of the polyline 2- The InputIterator type models the concept of a forward iterator 3- The input iterator value type is convertible to a value type of the OutputIterator 4- The range [first, last) contains only vertex coordinates in multiples of DIM, f.e.: x, y, z, x, y, z, x, y, z when DIM = 3 5- The range [first, last) contains at least 2 vertices 6- n is not 0

In case these requirements are not met, the entire input range [first, last) is copied to the output range [result, result + (last - first)) OR compile errors may occur.

Parameters
[in]firstthe first coordinate of the first polyline point
[in]lastone beyond the last coordinate of the last polyline point
[in]nspecifies 'each nth point'
[in]resultdestination of the simplified polyline
Returns
one beyond the last coordinate of the simplified polyline

Definition at line 492 of file psimpl.h.

◆ Opheim()

template<unsigned DIM, class InputIterator , class OutputIterator >
OutputIterator psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >::Opheim ( InputIterator  first,
InputIterator  last,
value_type  min_tol,
value_type  max_tol,
OutputIterator  result 
)
inline

Performs Opheim approximation (OP).

The O(n) OP routine is very similar to the Reumann-Witkam (RW) routine, and can be seen as a constrained version of that RW routine. OP uses both a minimum and a maximum distance tolerance to constrain the search area. For each successive vertex vi, its radial distance to the current key vkey (initially v0) is calculated. The last point within the minimum distance tolerance is used to define a ray R (vkey, vi). If no such vi exists, the ray is defined as R(vkey, vkey+1). For each successive vertex vj beyond vi its perpendicular distance to the ray R is calculated. A new key is found at vj-1, when this distance exceeds the minimum tolerance Or when the radial distance between vj and the vkey exceeds the maximum tolerance. After a new key is found, the process repeats itself.

OP routine is applied to the range [first, last) using the specified distance tolerances min_tol and max_tol. The resulting simplified polyline is copied to the output range [result, result + m*DIM), where m is the number of vertices of the simplified polyline. The return value is the end of the output range: result + m*DIM.

Input (Type) Requirements: 1- DIM is not 0, where DIM represents the dimension of the polyline 2- The InputIterator type models the concept of a forward iterator 3- The input iterator value type is convertible to a value type of the output iterator 4- The range [first, last) contains vertex coordinates in multiples of DIM, f.e.: x, y, z, x, y, z, x, y, z when DIM = 3 5- The range [first, last) contains at least 2 vertices 6- min_tol is not 0 7- max_tol is not 0

In case these requirements are not met, the entire input range [first, last) is copied to the output range [result, result + (last - first)) OR compile errors may occur.

Parameters
[in]firstthe first coordinate of the first polyline point
[in]lastone beyond the last coordinate of the last polyline point
[in]min_tolradial and perpendicular (point-to-ray) distance tolerance
[in]max_tolradial distance tolerance
[in]resultdestination of the simplified polyline
Returns
one beyond the last coordinate of the simplified polyline

Definition at line 872 of file psimpl.h.

◆ PerpendicularDistance() [1/2]

template<unsigned DIM, class InputIterator , class OutputIterator >
OutputIterator psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >::PerpendicularDistance ( InputIterator  first,
InputIterator  last,
value_type  tol,
OutputIterator  result 
)
inline

Performs the perpendicular distance routine (PD).

PD is an O(n) algorithm for polyline simplification. It computes the perpendicular distance of each point pi to the line segment S(pi-1, pi+1). Only when this distance is larger than the given tolerance will pi be part of the simpification. Note that the original polyline can only be reduced by a maximum of 50%. Multiple passes are required to achieve higher points reductions.

PD is applied to the range [first, last) using the specified tolerance tol. The resulting simplified polyline is copied to the output range [result, result + m*DIM), where m is the number of vertices of the simplified polyline. The return value is the end of the output range: result + m*DIM.

Input (Type) requirements: 1- DIM is not 0, where DIM represents the dimension of the polyline 2- The InputIterator type models the concept of a forward iterator 3- The input iterator value type is convertible to a value type of the output iterator 4- The range [first, last) contains only vertex coordinates in multiples of DIM, f.e.: x, y, z, x, y, z, x, y, z when DIM = 3 5- The range [first, last) contains at least 2 vertices 6- tol is not 0

In case these requirements are not met, the entire input range [first, last) is copied to the output range [result, result + (last - first)) OR compile errors may occur.

Parameters
[in]firstthe first coordinate of the first polyline point
[in]lastone beyond the last coordinate of the last polyline point
[in]tolperpendicular (segment-to-point) distance tolerance
[in]resultdestination of the simplified polyline
Returns
one beyond the last coordinate of the simplified polyline

Definition at line 697 of file psimpl.h.

◆ PerpendicularDistance() [2/2]

template<unsigned DIM, class InputIterator , class OutputIterator >
OutputIterator psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >::PerpendicularDistance ( InputIterator  first,
InputIterator  last,
value_type  tol,
unsigned  repeat,
OutputIterator  result 
)
inline

Repeatedly performs the perpendicular distance routine (PD).

The algorithm stops after calling the PD routine 'repeat' times OR when the simplification does not improve. Note that this algorithm will need to store up to two intermediate simplification results.

See also
PerpendicularDistance(InputIterator, InputIterator, value_type, OutputIterator)
Parameters
[in]firstthe first coordinate of the first polyline point
[in]lastone beyond the last coordinate of the last polyline point
[in]tolperpendicular (segment-to-point) distance tolerance
[in]repeatthe number of times to successively apply the PD routine
[in]resultdestination of the simplified polyline
Returns
one beyond the last coordinate of the simplified polyline

Definition at line 608 of file psimpl.h.

◆ RadialDistance()

template<unsigned DIM, class InputIterator , class OutputIterator >
OutputIterator psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >::RadialDistance ( InputIterator  first,
InputIterator  last,
value_type  tol,
OutputIterator  result 
)
inline

Performs the (radial) distance between points routine (RD).

RD is a brute-force O(n) algorithm for polyline simplification. It reduces successive vertices that are clustered too closely to a single vertex, called a key. The resulting keys form the simplified polyline.

RD is applied to the range [first, last) using the specified tolerance tol. The resulting simplified polyline is copied to the output range [result, result + m*DIM), where m is the number of vertices of the simplified polyline. The return value is the end of the output range: result + m*DIM.

Input (Type) requirements: 1- DIM is not 0, where DIM represents the dimension of the polyline 2- The InputIterator type models the concept of a forward iterator 3- The input iterator value type is convertible to a value type of the output iterator 4- The range [first, last) contains only vertex coordinates in multiples of DIM, f.e.: x, y, z, x, y, z, x, y, z when DIM = 3 5- The range [first, last) contains at least 2 vertices 6- tol is not 0

In case these requirements are not met, the entire input range [first, last) is copied to the output range [result, result + (last - first)) OR compile errors may occur.

Parameters
[in]firstthe first coordinate of the first polyline point
[in]lastone beyond the last coordinate of the last polyline point
[in]tolradial (point-to-point) distance tolerance
[in]resultdestination of the simplified polyline
Returns
one beyond the last coordinate of the simplified polyline

Definition at line 554 of file psimpl.h.

◆ ReumannWitkam()

template<unsigned DIM, class InputIterator , class OutputIterator >
OutputIterator psimpl::PolylineSimplification< DIM, InputIterator, OutputIterator >::ReumannWitkam ( InputIterator  first,
InputIterator  last,
value_type  tol,
OutputIterator  result 
)
inline

Performs Reumann-Witkam approximation (RW).

The O(n) RW routine uses a point-to-line (perpendicular) distance tolerance. It defines a line through the first two vertices of the original polyline. For each successive vertex vi its perpendicular distance to this line is calculated. A new key is found at vi-1, when this distance exceeds the specified tolerance. The vertices vi and vi+1 are then used to define a new line, and the process repeats itself.

RW routine is applied to the range [first, last) using the specified perpendicular distance tolerance tol. The resulting simplified polyline is copied to the output range [result, result + m*DIM), where m is the number of vertices of the simplified polyline. The return value is the end of the output range: result + m*DIM.

Input (Type) Requirements: 1- DIM is not 0, where DIM represents the dimension of the polyline 2- The InputIterator type models the concept of a forward iterator 3- The input iterator value type is convertible to a value type of the output iterator 4- The range [first, last) contains vertex coordinates in multiples of DIM, f.e.: x, y, z, x, y, z, x, y, z when DIM = 3 5- The range [first, last) contains at least 2 vertices 6- tol is not 0

In case these requirements are not met, the entire input range [first, last) is copied to the output range [result, result + (last - first)) OR compile errors may occur.

Parameters
[in]firstthe first coordinate of the first polyline point
[in]lastone beyond the last coordinate of the last polyline point
[in]tolperpendicular (point-to-line) distance tolerance
[in]resultdestination of the simplified polyline
Returns
one beyond the last coordinate of the simplified polyline

Definition at line 783 of file psimpl.h.


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


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:28