GEOS  3.9.1dev
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
geos::operation::buffer::BufferInputLineSimplifier Class Reference

Simplifies a buffer input line to remove concavities with shallow depth. More...

#include <BufferInputLineSimplifier.h>

Collaboration diagram for geos::operation::buffer::BufferInputLineSimplifier:
[legend]

Public Member Functions

 BufferInputLineSimplifier (const geom::CoordinateSequence &input)
 
std::unique_ptr< geom::CoordinateSequencesimplify (double distanceTol)
 

Static Public Member Functions

static std::unique_ptr< geom::CoordinateSequencesimplify (const geom::CoordinateSequence &inputLine, double distanceTol)
 

Private Member Functions

bool deleteShallowConcavities ()
 
size_t findNextNonDeletedIndex (size_t index) const
 
std::unique_ptr< geom::CoordinateSequencecollapseLine () const
 
bool isDeletable (size_t i0, size_t i1, size_t i2, double distanceTol) const
 
bool isShallowConcavity (const geom::Coordinate &p0, const geom::Coordinate &p1, const geom::Coordinate &p2, double distanceTol) const
 
bool isShallowSampled (const geom::Coordinate &p0, const geom::Coordinate &p2, size_t i0, size_t i2, double distanceTol) const
 
bool isShallow (const geom::Coordinate &p0, const geom::Coordinate &p1, const geom::Coordinate &p2, double distanceTol) const
 
bool isConcave (const geom::Coordinate &p0, const geom::Coordinate &p1, const geom::Coordinate &p2) const
 
 BufferInputLineSimplifier (const BufferInputLineSimplifier &other)=delete
 
BufferInputLineSimplifieroperator= (const BufferInputLineSimplifier &rhs)=delete
 

Private Attributes

const geom::CoordinateSequenceinputLine
 
double distanceTol
 
std::vector< int > isDeleted
 
int angleOrientation
 

Static Private Attributes

static const int NUM_PTS_TO_CHECK = 10
 
static const int INIT = 0
 
static const int DELETE = 1
 
static const int KEEP = 1
 

Detailed Description

Simplifies a buffer input line to remove concavities with shallow depth.

The most important benefit of doing this is to reduce the number of points and the complexity of shape which will be buffered. It also reduces the risk of gores created by the quantized fillet arcs (although this issue should be eliminated in any case by the offset curve generation logic).

A key aspect of the simplification is that it affects inside (concave or inward) corners only. Convex (outward) corners are preserved, since they are required to ensure that the generated buffer curve lies at the correct distance from the input geometry.

Another important heuristic used is that the end segments of the input are never simplified. This ensures that the client buffer code is able to generate end caps faithfully.

No attempt is made to avoid self-intersections in the output. This is acceptable for use for generating a buffer offset curve, since the buffer algorithm is insensitive to invalid polygonal geometry. However, this means that this algorithm cannot be used as a general-purpose polygon simplification technique.

Author
Martin Davis

Definition at line 72 of file BufferInputLineSimplifier.h.

Constructor & Destructor Documentation

geos::operation::buffer::BufferInputLineSimplifier::BufferInputLineSimplifier ( const geom::CoordinateSequence input)
geos::operation::buffer::BufferInputLineSimplifier::BufferInputLineSimplifier ( const BufferInputLineSimplifier other)
privatedelete

Member Function Documentation

std::unique_ptr<geom::CoordinateSequence> geos::operation::buffer::BufferInputLineSimplifier::collapseLine ( ) const
private
bool geos::operation::buffer::BufferInputLineSimplifier::deleteShallowConcavities ( )
private

Uses a sliding window containing 3 vertices to detect shallow angles in which the middle vertex can be deleted, since it does not affect the shape of the resulting buffer in a significant way.

Returns
size_t geos::operation::buffer::BufferInputLineSimplifier::findNextNonDeletedIndex ( size_t  index) const
private

Finds the next non-deleted index, or the end of the point array if none

Parameters
index
Returns
the next non-deleted index, if any
inputLine.size() if there are no more non-deleted indices
bool geos::operation::buffer::BufferInputLineSimplifier::isConcave ( const geom::Coordinate p0,
const geom::Coordinate p1,
const geom::Coordinate p2 
) const
private
bool geos::operation::buffer::BufferInputLineSimplifier::isDeletable ( size_t  i0,
size_t  i1,
size_t  i2,
double  distanceTol 
) const
private
bool geos::operation::buffer::BufferInputLineSimplifier::isShallow ( const geom::Coordinate p0,
const geom::Coordinate p1,
const geom::Coordinate p2,
double  distanceTol 
) const
private
bool geos::operation::buffer::BufferInputLineSimplifier::isShallowConcavity ( const geom::Coordinate p0,
const geom::Coordinate p1,
const geom::Coordinate p2,
double  distanceTol 
) const
private
bool geos::operation::buffer::BufferInputLineSimplifier::isShallowSampled ( const geom::Coordinate p0,
const geom::Coordinate p2,
size_t  i0,
size_t  i2,
double  distanceTol 
) const
private

Checks for shallowness over a sample of points in the given section.

This helps prevents the siplification from incrementally "skipping" over points which are in fact non-shallow.

Parameters
p0start coordinate of section
p2end coordinate of section
i0start index of section
i2end index of section
distanceToldistance tolerance
Returns
BufferInputLineSimplifier& geos::operation::buffer::BufferInputLineSimplifier::operator= ( const BufferInputLineSimplifier rhs)
privatedelete
static std::unique_ptr<geom::CoordinateSequence> geos::operation::buffer::BufferInputLineSimplifier::simplify ( const geom::CoordinateSequence inputLine,
double  distanceTol 
)
static

Simplify the input coordinate list.

If the distance tolerance is positive, concavities on the LEFT side of the line are simplified. If the supplied distance tolerance is negative, concavities on the RIGHT side of the line are simplified.

Parameters
inputLinethe coordinate sequence to simplify
distanceTolsimplification distance tolerance to use
Returns
a simplified version of the coordinate sequence
std::unique_ptr<geom::CoordinateSequence> geos::operation::buffer::BufferInputLineSimplifier::simplify ( double  distanceTol)

Simplify the input coordinate list. If the distance tolerance is positive, concavities on the LEFT side of the line are simplified. If the supplied distance tolerance is negative, concavities on the RIGHT side of the line are simplified.

Parameters
distanceTolsimplification distance tolerance to use
Returns
the simplified coordinate list

Member Data Documentation

int geos::operation::buffer::BufferInputLineSimplifier::angleOrientation
private

Definition at line 170 of file BufferInputLineSimplifier.h.

const int geos::operation::buffer::BufferInputLineSimplifier::DELETE = 1
staticprivate

Definition at line 163 of file BufferInputLineSimplifier.h.

double geos::operation::buffer::BufferInputLineSimplifier::distanceTol
private

Definition at line 167 of file BufferInputLineSimplifier.h.

const int geos::operation::buffer::BufferInputLineSimplifier::INIT = 0
staticprivate

Definition at line 162 of file BufferInputLineSimplifier.h.

const geom::CoordinateSequence& geos::operation::buffer::BufferInputLineSimplifier::inputLine
private

Definition at line 166 of file BufferInputLineSimplifier.h.

std::vector<int> geos::operation::buffer::BufferInputLineSimplifier::isDeleted
private

Definition at line 168 of file BufferInputLineSimplifier.h.

const int geos::operation::buffer::BufferInputLineSimplifier::KEEP = 1
staticprivate

Definition at line 164 of file BufferInputLineSimplifier.h.

const int geos::operation::buffer::BufferInputLineSimplifier::NUM_PTS_TO_CHECK = 10
staticprivate

Definition at line 160 of file BufferInputLineSimplifier.h.


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