intersections method

List<Vector2> intersections(
  1. Line otherLine
)

Implementation

List<Vector2> intersections(Line otherLine) {
  final determinant = a * otherLine.b - otherLine.a * b;
  if (determinant == 0) {
    //The lines are parallel (potentially coincides) and have no intersection
    return [];
  }
  return [
    Vector2(
      (otherLine.b * c - b * otherLine.c) / determinant,
      (a * otherLine.c - otherLine.a * c) / determinant,
    ),
  ];
}