class OffsetSegmentGenerator
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private BufferParameters |
bufParams |
private int |
closingSegLengthFactor
The Closing Segment Length Factor controls how long
"closing segments" are.
|
private static double |
CURVE_VERTEX_SNAP_DISTANCE_FACTOR
Factor which controls how close curve vertices can be to be snapped
|
private double |
distance |
private double |
filletAngleQuantum
The angle quantum with which to approximate a fillet curve
(based on the input # of quadrant segments)
|
private boolean |
hasNarrowConcaveAngle |
private static double |
INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR
Factor which controls how close curve vertices on inside turns can be to be snapped
|
private LineIntersector |
li |
private static int |
MAX_CLOSING_SEG_LEN_FACTOR
Factor which determines how short closing segs can be for round buffers
|
private double |
maxCurveSegmentError
the max error of approximation (distance) between a quad segment and the true fillet curve
|
private static double |
OFFSET_SEGMENT_SEPARATION_FACTOR
Factor which controls how close offset segments can be to
skip adding a filler or mitre.
|
private LineSegment |
offset0 |
private LineSegment |
offset1 |
private PrecisionModel |
precisionModel |
private Coordinate |
s0 |
private Coordinate |
s1 |
private Coordinate |
s2 |
private LineSegment |
seg0 |
private LineSegment |
seg1 |
private OffsetSegmentString |
segList |
private int |
side |
Constructor and Description |
---|
OffsetSegmentGenerator(PrecisionModel precisionModel,
BufferParameters bufParams,
double distance) |
Modifier and Type | Method and Description |
---|---|
private void |
addBevelJoin(LineSegment offset0,
LineSegment offset1)
Adds a bevel join connecting the two offset segments
around a reflex corner.
|
private void |
addCollinear(boolean addStartPoint) |
private void |
addCornerFillet(Coordinate p,
Coordinate p0,
Coordinate p1,
int direction,
double radius)
Add points for a circular fillet around a reflex corner.
|
private void |
addDirectedFillet(Coordinate p,
double startAngle,
double endAngle,
int direction,
double radius)
Adds points for a circular fillet arc
between two specified angles.
|
void |
addFirstSegment() |
private void |
addInsideTurn(int orientation,
boolean addStartPoint)
Adds the offset points for an inside (concave) turn.
|
void |
addLastSegment()
Add last offset point
|
private void |
addLimitedMitreJoin(LineSegment offset0,
LineSegment offset1,
double distance,
double mitreLimit)
Adds a limited mitre join connecting the two reflex offset segments.
|
void |
addLineEndCap(Coordinate p0,
Coordinate p1)
Add an end cap around point p1, terminating a line segment coming from p0
|
private void |
addMitreJoin(Coordinate p,
LineSegment offset0,
LineSegment offset1,
double distance)
Adds a mitre join connecting the two reflex offset segments.
|
void |
addNextSegment(Coordinate p,
boolean addStartPoint) |
private void |
addOutsideTurn(int orientation,
boolean addStartPoint)
Adds the offset points for an outside (convex) turn
|
void |
addSegments(Coordinate[] pt,
boolean isForward) |
void |
closeRing() |
private void |
computeOffsetSegment(LineSegment seg,
int side,
double distance,
LineSegment offset)
Compute an offset segment for an input segment on a given side and at a given distance.
|
void |
createCircle(Coordinate p)
Creates a CW circle around a point
|
void |
createSquare(Coordinate p)
Creates a CW square around a point
|
Coordinate[] |
getCoordinates() |
boolean |
hasNarrowConcaveAngle()
Tests whether the input has a narrow concave angle
(relative to the offset distance).
|
private void |
init(double distance) |
void |
initSideSegments(Coordinate s1,
Coordinate s2,
int side) |
private static final double OFFSET_SEGMENT_SEPARATION_FACTOR
private static final double INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR
private static final double CURVE_VERTEX_SNAP_DISTANCE_FACTOR
private static final int MAX_CLOSING_SEG_LEN_FACTOR
private double maxCurveSegmentError
private double filletAngleQuantum
private int closingSegLengthFactor
private OffsetSegmentString segList
private double distance
private PrecisionModel precisionModel
private BufferParameters bufParams
private LineIntersector li
private Coordinate s0
private Coordinate s1
private Coordinate s2
private LineSegment seg0
private LineSegment seg1
private LineSegment offset0
private LineSegment offset1
private int side
private boolean hasNarrowConcaveAngle
public OffsetSegmentGenerator(PrecisionModel precisionModel, BufferParameters bufParams, double distance)
public boolean hasNarrowConcaveAngle()
private void init(double distance)
public void initSideSegments(Coordinate s1, Coordinate s2, int side)
public Coordinate[] getCoordinates()
public void closeRing()
public void addSegments(Coordinate[] pt, boolean isForward)
public void addFirstSegment()
public void addLastSegment()
public void addNextSegment(Coordinate p, boolean addStartPoint)
private void addCollinear(boolean addStartPoint)
private void addOutsideTurn(int orientation, boolean addStartPoint)
orientation
- addStartPoint
- private void addInsideTurn(int orientation, boolean addStartPoint)
orientation
- addStartPoint
- private void computeOffsetSegment(LineSegment seg, int side, double distance, LineSegment offset)
seg
- the segment to offsetside
- the side of the segment (Position
) the offset lies ondistance
- the offset distanceoffset
- the points computed for the offset segmentpublic void addLineEndCap(Coordinate p0, Coordinate p1)
private void addMitreJoin(Coordinate p, LineSegment offset0, LineSegment offset1, double distance)
offset0
- the first offset segmentoffset1
- the second offset segmentdistance
- the offset distanceprivate void addLimitedMitreJoin(LineSegment offset0, LineSegment offset1, double distance, double mitreLimit)
offset0
- the first offset segmentoffset1
- the second offset segmentdistance
- the offset distancemitreLimit
- the mitre limit ratioprivate void addBevelJoin(LineSegment offset0, LineSegment offset1)
offset0
- the first offset segmentoffset1
- the second offset segmentprivate void addCornerFillet(Coordinate p, Coordinate p0, Coordinate p1, int direction, double radius)
p
- base point of curvep0
- start point of fillet curvep1
- endpoint of fillet curvedirection
- the orientation of the filletradius
- the radius of the filletprivate void addDirectedFillet(Coordinate p, double startAngle, double endAngle, int direction, double radius)
direction
- is -1 for a CW angle, 1 for a CCW angleradius
- the radius of the filletpublic void createCircle(Coordinate p)
public void createSquare(Coordinate p)