tangentAt method

Line tangentAt(
  1. Point point
)

Get tangent line at point on boundary

Returns a line perpendicular to radius at that point. point should be on or near the boundary.

Implementation

Line tangentAt(Point point) {
  final dx = point.x - center.x;
  final dy = point.y - center.y;
  // Tangent is perpendicular to radius: rotate direction 90°
  return Line(
    Point(point.x - dy, point.y + dx),
    Point(point.x + dy, point.y - dx),
  );
}