isPointBelongToLineSegment method Null safety

bool isPointBelongToLineSegment(
  1. Point<num> point,
  2. Line line
)

Check if a point is belonged to the segment

Implementation

static bool isPointBelongToLineSegment(Point point, Line line) {
  final ac = point.distanceTo(line.p1);
  final bc = point.distanceTo(line.p2);
  final ab = line.p1.distanceTo(line.p2);
  return ac + bc == ab;
}