Corner constructor

Corner(
  1. Coord? prev,
  2. Coord point,
  3. Coord? next,
  4. num radius, [
  5. Rect? rect,
  6. bool inCircle = false,
])

Provide rect in case the object is bounded inside a box, rect.

Implementation

Corner(Coord? prev, this.point, Coord? next, num radius,
    [Rect? rect, this.inCircle = false]) {
  this.prev = prev ?? next ?? point;
  this.next = next ?? prev ?? point;

  final crossProduct = (point - this.prev).cross(this.next - point);
  if (crossProduct == 0) {
    throw ArgumentError('Given corner is a straight line');
  }

  clockwise = crossProduct < 0;

  circle =
      _circleIfPointCloseToEdge(_circleAccordingToLine(radius), radius, rect);
}