addOutsideTurn method

void addOutsideTurn(
  1. int orientation,
  2. bool addStartPoint
)

Adds the offset points for an outside (convex) turn

@param orientation @param addStartPoint

Implementation

void addOutsideTurn(int orientation, bool addStartPoint) {
  /**
   * Heuristic: If offset endpoints are very close together,
   * just use one of them as the corner vertex.
   * This avoids problems with computing mitre corners in the case
   * where the two segments are almost parallel
   * (which is hard to compute a robust intersection for).
   */
  if (offset0.p1.distance(offset1.p0) <
      distance * OFFSET_SEGMENT_SEPARATION_FACTOR) {
    segList.addPt(offset0.p1);
    return;
  }

  if (bufParams.getJoinStyle() == BufferParameters.JOIN_MITRE) {
    addMitreJoin(s1, offset0, offset1, distance);
  } else if (bufParams.getJoinStyle() == BufferParameters.JOIN_BEVEL) {
    addBevelJoin(offset0, offset1);
  } else {
    // add a circular fillet connecting the endpoints of the offset segments
    if (addStartPoint) segList.addPt(offset0.p1);
    // TESTING - comment out to produce beveled joins
    addCornerFillet(s1, offset0.p1, offset1.p0, orientation, distance);
    segList.addPt(offset1.p0);
  }
}