computeLineBufferCurve method
Implementation
void computeLineBufferCurve(
List<Coordinate> inputPts, OffsetSegmentGenerator segGen) {
double distTol = simplifyTolerance(distance);
//--------- compute points for left side of line
// Simplify the appropriate side of the line before generating
List<Coordinate> simp1 =
BufferInputLineSimplifier.simplify(inputPts, distTol);
// MD - used for testing only (to eliminate simplification)
// List<Coordinate> simp1 = inputPts;
int n1 = simp1.length - 1;
segGen.initSideSegments(simp1[0], simp1[1], Position.LEFT);
for (int i = 2; i <= n1; i++) {
segGen.addNextSegment(simp1[i], true);
}
segGen.addLastSegment();
// add line cap for end of line
segGen.addLineEndCap(simp1[n1 - 1], simp1[n1]);
//---------- compute points for right side of line
// Simplify the appropriate side of the line before generating
List<Coordinate> simp2 =
BufferInputLineSimplifier.simplify(inputPts, -distTol);
// MD - used for testing only (to eliminate simplification)
// List<Coordinate> simp2 = inputPts;
int n2 = simp2.length - 1;
// since we are traversing line in opposite order, offset position is still LEFT
segGen.initSideSegments(simp2[n2], simp2[n2 - 1], Position.LEFT);
for (int i = n2 - 2; i >= 0; i--) {
segGen.addNextSegment(simp2[i], true);
}
segGen.addLastSegment();
// add line cap for start of line
segGen.addLineEndCap(simp2[1], simp2[0]);
segGen.closeRing();
}