GEOS
3.9.1dev
|
Simplifies a buffer input line to remove concavities with shallow depth. More...
#include <BufferInputLineSimplifier.h>
Public Member Functions | |
BufferInputLineSimplifier (const geom::CoordinateSequence &input) | |
std::unique_ptr< geom::CoordinateSequence > | simplify (double distanceTol) |
Static Public Member Functions | |
static std::unique_ptr< geom::CoordinateSequence > | simplify (const geom::CoordinateSequence &inputLine, double distanceTol) |
Private Member Functions | |
bool | deleteShallowConcavities () |
size_t | findNextNonDeletedIndex (size_t index) const |
std::unique_ptr< geom::CoordinateSequence > | collapseLine () 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 | |
BufferInputLineSimplifier & | operator= (const BufferInputLineSimplifier &rhs)=delete |
Private Attributes | |
const geom::CoordinateSequence & | inputLine |
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 |
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.
Definition at line 72 of file BufferInputLineSimplifier.h.
geos::operation::buffer::BufferInputLineSimplifier::BufferInputLineSimplifier | ( | const geom::CoordinateSequence & | input | ) |
|
privatedelete |
|
private |
|
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.
|
private |
Finds the next non-deleted index, or the end of the point array if none
index |
|
private |
|
private |
|
private |
|
private |
|
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.
p0 | start coordinate of section |
p2 | end coordinate of section |
i0 | start index of section |
i2 | end index of section |
distanceTol | distance tolerance |
|
privatedelete |
|
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.
inputLine | the coordinate sequence to simplify |
distanceTol | simplification distance tolerance to use |
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.
distanceTol | simplification distance tolerance to use |
|
private |
Definition at line 170 of file BufferInputLineSimplifier.h.
|
staticprivate |
Definition at line 163 of file BufferInputLineSimplifier.h.
|
private |
Definition at line 167 of file BufferInputLineSimplifier.h.
|
staticprivate |
Definition at line 162 of file BufferInputLineSimplifier.h.
|
private |
Definition at line 166 of file BufferInputLineSimplifier.h.
|
private |
Definition at line 168 of file BufferInputLineSimplifier.h.
|
staticprivate |
Definition at line 164 of file BufferInputLineSimplifier.h.
|
staticprivate |
Definition at line 160 of file BufferInputLineSimplifier.h.