diff --git a/masque/shapes/rect_collection.py b/masque/shapes/rect_collection.py index eaf028f..291f23a 100644 --- a/masque/shapes/rect_collection.py +++ b/masque/shapes/rect_collection.py @@ -187,7 +187,12 @@ class RectCollection(Shape): def rotate(self, theta: float) -> Self: quarter_turns = int(numpy.rint(theta / (pi / 2))) if not numpy.isclose(theta, quarter_turns * (pi / 2)): - raise PatternError('RectCollection only supports Manhattan rotations') + raise PatternError( + f'RectCollection cannot rotate by {theta!r} radians; only Manhattan rotations (multiples of pi/2) are supported. ' + 'Explicitly replace the collection with to_polygons(), or call Pattern.polygonize() ' + 'on the pattern containing it (including referenced child patterns) before transforming, ' + 'flattening, or computing hierarchical bounds.' + ) turns = quarter_turns % 4 if turns == 0 or self._rects.size == 0: return self