addCornerFillet method

void addCornerFillet(
  1. Coordinate p,
  2. Coordinate p0,
  3. Coordinate p1,
  4. int direction,
  5. double radius,
)

Add points for a circular fillet around a reflex corner. Adds the start and end points

@param p base point of curve @param p0 start point of fillet curve @param p1 endpoint of fillet curve @param direction the orientation of the fillet @param radius the radius of the fillet

Implementation

void addCornerFillet(Coordinate p, Coordinate p0, Coordinate p1,
    int direction, double radius) {
  double dx0 = p0.x - p.x;
  double dy0 = p0.y - p.y;
  double startAngle = math.atan2(dy0, dx0);
  double dx1 = p1.x - p.x;
  double dy1 = p1.y - p.y;
  double endAngle = math.atan2(dy1, dx1);

  if (direction == Orientation.CLOCKWISE) {
    if (startAngle <= endAngle) startAngle += 2.0 * math.pi;
  } else {
    // direction == COUNTERCLOCKWISE
    if (startAngle >= endAngle) startAngle -= 2.0 * math.pi;
  }
  segList.addPt(p0);
  addDirectedFillet(p, startAngle, endAngle, direction, radius);
  segList.addPt(p1);
}