intersections function

List<Vector2> intersections(
  1. ShapeComponent shapeA,
  2. ShapeComponent shapeB, {
  3. Rect? overlappingRect,
})

Implementation

List<Vector2> intersections(
  ShapeComponent shapeA,
  ShapeComponent shapeB, {
  Rect? overlappingRect,
}) {
  final intersectionSystem = _intersectionSystems.firstWhere(
    (system) => system.supportsShapes(shapeA, shapeB),
    orElse: () {
      throw 'Unsupported intersection detected between: '
          '${shapeA.runtimeType} and ${shapeB.runtimeType}';
    },
  );
  return intersectionSystem.unorderedIntersect(
    shapeA,
    shapeB,
    overlappingRect: overlappingRect,
  );
}