shapeToShape static method

bool shapeToShape(
  1. Shape a,
  2. Shape b
)

Implementation

static bool shapeToShape(Shape a, Shape b) {
  return switch ((a, b)) {
    (AABB aabbA, AABB aabbB) => rectToRect(aabbA, aabbB),
    (Circle circleA, Circle circleB) => circleToCircle(circleA, circleB),
    (AABB aabb, Circle circle) => circleToRect(circle, aabb),
    (Circle circle, AABB aabb) => circleToRect(circle, aabb),
    (Line lineA, Line lineB) => lineToLine(lineA, lineB),
    (Line line, AABB rect) => lineToRect(line, rect),
    (Line line, Circle circle) => lineToCircle(line, circle),
    (AABB rect, Line line) => lineToRect(line, rect),
    (Circle circle, Line line) => lineToCircle(line, circle),
    _ => throw UnimplementedError(
        '${a.runtimeType} and ${b.runtimeType} is not defined for CollisionDetector.',
      ),
  };
}