GEOS
3.9.1dev
|
#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. More... | |
void | createSquare (const geom::Coordinate &p, double distance) |
Adds a CW square around a point. More... | |
void | addFirstSegment () |
Add first offset point. More... | |
void | addLastSegment () |
Add last offset point. More... | |
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. More... | |
void | addSegments (const geom::CoordinateSequence &pts, bool isForward) |
Private Member Functions | |
void | addCollinear (bool addStartPoint) |
void | addMitreJoin (const geom::Coordinate &p, const geom::LineSegment &offset0, const geom::LineSegment &offset1, double distance) |
void | addLimitedMitreJoin (const geom::LineSegment &offset0, const geom::LineSegment &offset1, double distance, double mitreLimit) |
void | addBevelJoin (const geom::LineSegment &offset0, const geom::LineSegment &offset1) |
Adds a bevel join connecting the two offset segments around a reflex corner. More... | |
void | init (double newDistance) |
void | addOutsideTurn (int orientation, bool addStartPoint) |
void | addInsideTurn (int orientation, bool addStartPoint) |
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... | |
void | addDirectedFillet (const geom::Coordinate &p, const geom::Coordinate &p0, const geom::Coordinate &p1, int direction, double radius) |
void | addDirectedFillet (const geom::Coordinate &p, double startAngle, double endAngle, int direction, double radius) |
OffsetSegmentGenerator (const OffsetSegmentGenerator &) | |
void | operator= (const OffsetSegmentGenerator &) |
Private Attributes | |
double | maxCurveSegmentError |
the max error of approximation (distance) between a quad segment and the true fillet curve More... | |
double | filletAngleQuantum |
The angle quantum with which to approximate a fillet curve (based on the input # of quadrant segments) More... | |
int | closingSegLengthFactor |
OffsetSegmentString | segList |
double | distance |
const geom::PrecisionModel * | precisionModel |
const BufferParameters & | bufParams |
algorithm::LineIntersector | li |
geom::Coordinate | s0 |
geom::Coordinate | s1 |
geom::Coordinate | s2 |
geom::LineSegment | seg0 |
geom::LineSegment | seg1 |
geom::LineSegment | offset0 |
geom::LineSegment | offset1 |
int | side |
bool | _hasNarrowConcaveAngle |
int | endCapIndex |
Static Private Attributes | |
static const double | OFFSET_SEGMENT_SEPARATION_FACTOR |
static const double | INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR |
static const double | CURVE_VERTEX_SNAP_DISTANCE_FACTOR |
static const int | MAX_CLOSING_SEG_LEN_FACTOR = 80 |
static const double | PI |
static const double | SIMPLIFY_FACTOR |
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.
Definition at line 61 of file OffsetSegmentGenerator.h.
geos::operation::buffer::OffsetSegmentGenerator::OffsetSegmentGenerator | ( | const geom::PrecisionModel * | newPrecisionModel, |
const BufferParameters & | bufParams, | ||
double | distance | ||
) |
|
private |
|
private |
Adds a bevel join connecting the two offset segments around a reflex corner.
offset0 | the first offset segment |
offset1 | the second offset segment |
|
private |
|
private |
Adds points for a circular fillet around a reflex corner.
Adds the start and end points
p | base point of curve |
p0 | start point of fillet curve |
p1 | endpoint of fillet curve |
direction | the orientation of the fillet |
radius | the radius of the fillet |
|
private |
Adds points for a circular fillet arc between two specified angles.
The start and end point for the fillet are not added - the caller must add them if required.
direction | is -1 for a CW angle, 1 for a CCW angle |
radius | the radius of the fillet |
|
inline |
Add first offset point.
Definition at line 124 of file OffsetSegmentGenerator.h.
|
private |
Adds the offset points for an inside (concave) turn
orientation | |
addStartPoint |
|
inline |
Add last offset point.
Definition at line 131 of file OffsetSegmentGenerator.h.
|
private |
Adds a limited mitre join connecting the two reflex offset segments.
A limited mitre is a mitre which is beveled at the distance determined by the mitre ratio limit.
offset0 | the first offset segment |
offset1 | the second offset segment |
distance | the offset distance |
mitreLimit | the mitre limit ratio |
void geos::operation::buffer::OffsetSegmentGenerator::addLineEndCap | ( | const geom::Coordinate & | p0, |
const geom::Coordinate & | p1 | ||
) |
Add an end cap around point p1, terminating a line segment coming from p0.
|
private |
The mitre will be beveled if it exceeds the mitre ratio limit.
offset0 | the first offset segment |
offset1 | the second offset segment |
distance | the offset distance |
void geos::operation::buffer::OffsetSegmentGenerator::addNextSegment | ( | const geom::Coordinate & | p, |
bool | addStartPoint | ||
) |
|
private |
Adds the offset points for an outside (convex) turn
orientation | |
addStartPoint |
|
inline |
Definition at line 145 of file OffsetSegmentGenerator.h.
|
inline |
Definition at line 111 of file OffsetSegmentGenerator.h.
|
private |
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.
seg | the segment to offset |
side | the side of the segment the offset lies on |
distance | the offset distance |
offset | the points computed for the offset segment |
void geos::operation::buffer::OffsetSegmentGenerator::createCircle | ( | const geom::Coordinate & | p, |
double | distance | ||
) |
Adds a CW circle around a point.
void geos::operation::buffer::OffsetSegmentGenerator::createSquare | ( | const geom::Coordinate & | p, |
double | distance | ||
) |
Adds a CW square around a point.
|
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
Definition at line 105 of file OffsetSegmentGenerator.h.
|
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.
Definition at line 88 of file OffsetSegmentGenerator.h.
|
private |
void geos::operation::buffer::OffsetSegmentGenerator::initSideSegments | ( | const geom::Coordinate & | nS1, |
const geom::Coordinate & | nS2, | ||
int | nSide | ||
) |
|
private |
|
private |
Definition at line 235 of file OffsetSegmentGenerator.h.
|
private |
Definition at line 219 of file OffsetSegmentGenerator.h.
|
private |
The Closing Segment Factor controls how long "closing segments" are. Closing segments are added at the middle of inside corners to ensure a smoother boundary for the buffer offset curve. In some cases (particularly for round joins with default-or-better quantization) the closing segments can be made quite short. This substantially improves performance (due to fewer intersections being created).
A closingSegFactor of 0 results in lines to the corner vertex. A closingSegFactor of 1 results in lines halfway to the corner vertex. A closingSegFactor of 80 results in lines 1/81 of the way to the corner vertex (this option is reasonable for the very common default situation of round joins and quadrantSegs >= 8).
The default is 1.
Definition at line 203 of file OffsetSegmentGenerator.h.
|
staticprivate |
Factor which controls how close curve vertices can be to be snapped
Definition at line 167 of file OffsetSegmentGenerator.h.
|
private |
Definition at line 215 of file OffsetSegmentGenerator.h.
|
private |
Definition at line 278 of file OffsetSegmentGenerator.h.
|
private |
The angle quantum with which to approximate a fillet curve (based on the input # of quadrant segments)
Definition at line 184 of file OffsetSegmentGenerator.h.
|
staticprivate |
Factor which controls how close curve vertices on inside turns can be to be snapped
Definition at line 162 of file OffsetSegmentGenerator.h.
|
private |
Definition at line 221 of file OffsetSegmentGenerator.h.
|
staticprivate |
Factor which determines how short closing segs can be for round buffers
Definition at line 172 of file OffsetSegmentGenerator.h.
|
private |
the max error of approximation (distance) between a quad segment and the true fillet curve
Definition at line 178 of file OffsetSegmentGenerator.h.
|
private |
Definition at line 229 of file OffsetSegmentGenerator.h.
|
private |
Definition at line 231 of file OffsetSegmentGenerator.h.
|
staticprivate |
Factor which controls how close offset segments can be to skip adding a filler or mitre.
Definition at line 156 of file OffsetSegmentGenerator.h.
|
staticprivate |
Definition at line 275 of file OffsetSegmentGenerator.h.
|
private |
Definition at line 217 of file OffsetSegmentGenerator.h.
|
private |
Definition at line 223 of file OffsetSegmentGenerator.h.
|
private |
Definition at line 223 of file OffsetSegmentGenerator.h.
|
private |
Definition at line 223 of file OffsetSegmentGenerator.h.
|
private |
Definition at line 225 of file OffsetSegmentGenerator.h.
|
private |
Definition at line 227 of file OffsetSegmentGenerator.h.
|
private |
Owned by this object, destroyed by dtor
This actually gets created multiple times and each of the old versions is pushed to the ptLists std::vector to ensure all created CoordinateSequences are properly destroyed.
Definition at line 213 of file OffsetSegmentGenerator.h.
|
private |
Definition at line 233 of file OffsetSegmentGenerator.h.
|
staticprivate |
Use a value which results in a potential distance error which is significantly less than the error due to the quadrant segment discretization. For QS = 8 a value of 100 is reasonable. This should produce a maximum of 1% distance error.
Definition at line 289 of file OffsetSegmentGenerator.h.