GEOS 3.11.1
Public Member Functions | Static Public Member Functions | List of all members
geos::operation::buffer::OffsetSegmentGenerator Class Reference

#include <OffsetSegmentGenerator.h>

Public Member Functions

 OffsetSegmentGenerator (const geom::PrecisionModel *newPrecisionModel, const BufferParameters &bufParams, double distance)
 
bool hasNarrowConcaveAngle () const
 
void initSideSegments (const geom::Coordinate &nS1, const geom::Coordinate &nS2, int nSide)
 
void getCoordinates (std::vector< geom::CoordinateSequence * > &to)
 
void closeRing ()
 
void createCircle (const geom::Coordinate &p, double distance)
 Adds a CW circle around a point.
 
void createSquare (const geom::Coordinate &p, double distance)
 Adds a CW square around a point.
 
void addFirstSegment ()
 Add first offset point.
 
void addLastSegment ()
 Add last offset point.
 
void addNextSegment (const geom::Coordinate &p, bool addStartPoint)
 
void addLineEndCap (const geom::Coordinate &p0, const geom::Coordinate &p1)
 Add an end cap around point p1, terminating a line segment coming from p0.
 
void addSegments (const geom::CoordinateSequence &pts, bool isForward)
 

Static Public Member Functions

static void computeOffsetSegment (const geom::LineSegment &seg, int side, double distance, geom::LineSegment &offset)
 Compute an offset segment for an input segment on a given side and at a given distance. More...
 

Detailed Description

Generates segments which form an offset curve. Supports all end cap and join options provided for buffering. Implements various heuristics to produce smoother, simpler curves which are still within a reasonable tolerance of the true curve.

Author
Martin Davis

Member Function Documentation

◆ computeOffsetSegment()

static void geos::operation::buffer::OffsetSegmentGenerator::computeOffsetSegment ( const geom::LineSegment seg,
int  side,
double  distance,
geom::LineSegment offset 
)
static

Compute an offset segment for an input segment on a given side and at a given distance.

The offset points are computed in full double precision, for accuracy.

Parameters
segthe segment to offset
sidethe side of the segment the offset lies on
distancethe offset distance
offsetthe points computed for the offset segment

◆ getCoordinates()

void geos::operation::buffer::OffsetSegmentGenerator::getCoordinates ( std::vector< geom::CoordinateSequence * > &  to)
inline

Get coordinates by taking ownership of them

After this call, the coordinates reference in this object are dropped. Calling twice will segfault...

FIXME: refactor memory management of this

◆ hasNarrowConcaveAngle()

bool geos::operation::buffer::OffsetSegmentGenerator::hasNarrowConcaveAngle ( ) const
inline

Tests whether the input has a narrow concave angle (relative to the offset distance). In this case the generated offset curve will contain self-intersections and heuristic closing segments. This is expected behaviour in the case of buffer curves. For pure offset curves, the output needs to be further treated before it can be used.

Returns
true if the input has a narrow concave angle

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