[BREAKING][Ref / Label / Pattern] Make rotate/mirror consistent intrinsic transfomations
offset and repetition are extrinsic; use rotate_around() and flip() to alter both mirror() and rotate() only affect the object's intrinsic properties
This commit is contained in:
parent
db22237369
commit
5f91bd9c6c
6 changed files with 204 additions and 25 deletions
|
|
@ -98,18 +98,20 @@ class Label(PositionableImpl, RepeatableImpl, AnnotatableImpl, Bounded, Pivotabl
|
|||
"""
|
||||
pivot = numpy.asarray(pivot, dtype=float)
|
||||
self.translate(-pivot)
|
||||
if self.repetition is not None:
|
||||
self.repetition.rotate(rotation)
|
||||
self.offset = numpy.dot(rotation_matrix_2d(rotation), self.offset)
|
||||
self.translate(+pivot)
|
||||
return self
|
||||
|
||||
def flip_across(self, axis: int | None = None, *, x: float | None = None, y: float | None = None) -> Self:
|
||||
"""
|
||||
Flip the label across a line in the pattern's coordinate system.
|
||||
|
||||
This operation mirrors the label's offset relative to the pattern's origin.
|
||||
Extrinsic transformation: Flip the label across a line in the pattern's
|
||||
coordinate system. This affects both the label's offset and its
|
||||
repetition grid.
|
||||
|
||||
Args:
|
||||
axis: Axis to mirror across. 0 mirrors across y=0. 1 mirrors across x=0.
|
||||
axis: Axis to mirror across. 0: x-axis (flip y), 1: y-axis (flip x).
|
||||
x: Vertical line x=val to mirror across.
|
||||
y: Horizontal line y=val to mirror across.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue