addCollinear method

void addCollinear(
  1. bool addStartPoint
)

Implementation

void addCollinear(bool addStartPoint) {
  /**
   * This test could probably be done more efficiently,
   * but the situation of exact collinearity should be fairly rare.
   */
  li!.computeIntersection(s0, s1, s1, s2);
  int numInt = li!.getIntersectionNum();
  /**
   * if numInt is < 2, the lines are parallel and in the same direction. In
   * this case the point can be ignored, since the offset lines will also be
   * parallel.
   */
  if (numInt >= 2) {
    /**
     * segments are collinear but reversing.
     * Add an "end-cap" fillet
     * all the way around to other direction This case should ONLY happen
     * for LineStrings, so the orientation is always CW. (Polygons can never
     * have two consecutive segments which are parallel but reversed,
     * because that would be a self intersection.
     *
     */
    if (bufParams.getJoinStyle() == BufferParameters.JOIN_BEVEL ||
        bufParams.getJoinStyle() == BufferParameters.JOIN_MITRE) {
      if (addStartPoint) segList.addPt(offset0.p1);
      segList.addPt(offset1.p0);
    } else {
      addCornerFillet(
          s1, offset0.p1, offset1.p0, Orientation.CLOCKWISE, distance);
    }
  }
}