public Coordinate[] getOffsetCurve(Coordinate[] inputPts, double distance) { this.distance = distance; // a zero width offset curve is empty if (distance == 0.0) return null; boolean isRightSide = distance < 0.0; double posDistance = Math.abs(distance); OffsetSegmentGenerator segGen = getSegGen(posDistance); if (inputPts.length <= 1) { computePointCurve(inputPts[0], segGen); } else { computeOffsetCurve(inputPts, isRightSide, segGen); } Coordinate[] curvePts = segGen.getCoordinates(); // for right side line is traversed in reverse direction, so have to reverse generated line if (isRightSide) CoordinateArrays.reverse(curvePts); return curvePts; }
/** * This method handles the degenerate cases of single points and lines, * as well as rings. * * @return a Coordinate array representing the curve * or null if the curve is empty */ public Coordinate[] getRingCurve(Coordinate[] inputPts, int side, double distance) { this.distance = distance; if (inputPts.length <= 2) return getLineCurve(inputPts, distance); // optimize creating ring for for zero distance if (distance == 0.0) { return copyCoordinates(inputPts); } OffsetSegmentGenerator segGen = getSegGen(distance); computeRingBufferCurve(inputPts, side, segGen); return segGen.getCoordinates(); }
OffsetSegmentGenerator segGen = getSegGen(posDistance); if (inputPts.length <= 1) { computePointCurve(inputPts[0], segGen);
public Coordinate[] getOffsetCurve(Coordinate[] inputPts, double distance) { this.distance = distance; // a zero width offset curve is empty if (distance == 0.0) return null; boolean isRightSide = distance < 0.0; double posDistance = Math.abs(distance); OffsetSegmentGenerator segGen = getSegGen(posDistance); if (inputPts.length <= 1) { computePointCurve(inputPts[0], segGen); } else { computeOffsetCurve(inputPts, isRightSide, segGen); } Coordinate[] curvePts = segGen.getCoordinates(); // for right side line is traversed in reverse direction, so have to reverse generated line if (isRightSide) CoordinateArrays.reverse(curvePts); return curvePts; }
/** * This method handles the degenerate cases of single points and lines, * as well as rings. * * @return a Coordinate array representing the curve * or null if the curve is empty */ public Coordinate[] getRingCurve(Coordinate[] inputPts, int side, double distance) { this.distance = distance; if (inputPts.length <= 2) return getLineCurve(inputPts, distance); // optimize creating ring for for zero distance if (distance == 0.0) { return copyCoordinates(inputPts); } OffsetSegmentGenerator segGen = getSegGen(distance); computeRingBufferCurve(inputPts, side, segGen); return segGen.getCoordinates(); }
OffsetSegmentGenerator segGen = getSegGen(posDistance); if (inputPts.length <= 1) { computePointCurve(inputPts[0], segGen);