[mirror / flip_across] improve documentation

This commit is contained in:
jan 2026-02-15 19:46:47 -08:00
commit abf236a046
3 changed files with 18 additions and 6 deletions

View file

@ -18,7 +18,11 @@ class Mirrorable(metaclass=ABCMeta):
@abstractmethod
def mirror(self, axis: int = 0) -> Self:
"""
Mirror the entity across an axis through its origin, ignoring its offset.
Mirror the entity across an axis through its origin.
This operation is performed relative to the object's internal origin (ignoring
its offset). For objects like `Polygon` and `Path` where the offset is forced
to (0, 0), this is equivalent to mirroring in the container's coordinate system.
Args:
axis: Axis to mirror across (0: x-axis, 1: y-axis).
@ -70,10 +74,14 @@ class Flippable(Positionable, metaclass=ABCMeta):
@abstractmethod
def flip_across(self, axis: int | None = None, *, x: float | None = None, y: float | None = None) -> Self:
"""
Mirror the object across a line.
Mirror the object across a line in the container's coordinate system.
Unlike `mirror()`, this operation is performed relative to the container's origin
(e.g. the `Pattern` origin, in the case of shapes) and takes the object's offset
into account.
Args:
axis: Axis to mirror across. 0 mirrors across x=0. 1 mirrors across y=0.
axis: Axis to mirror across. 0 mirrors across y=0. 1 mirrors across x=0.
x: Vertical line x=val to mirror across.
y: Horizontal line y=val to mirror across.