difference static method

Shape difference(
  1. Shape a,
  2. Shape b
)

Implementation

static Shape difference(Shape a, Shape b) {
  return switch ((a, b)) {
    (AABB aabbA, AABB aabbB) => differenceAABB(aabbA, aabbB),
    (Circle circleA, Circle circleB) => differenceCircle(circleA, circleB),
    (AABB aabb, Circle circle) => differenceAABBAndCircle(aabb, circle),
    (Circle circle, AABB aabb) => differenceCircleAndAABB(circle, aabb),
    _ => throw UnimplementedError(
        '${a.runtimeType} and ${b.runtimeType} is not defined for Minkowski.',
      ),
  };
}