Skip to content

Apply in-plane scaling and mirroring in MLine.transform() - #1463

Merged
mozman merged 1 commit into
mozman:masterfrom
RavSinghChandan:mline-transform-scale
Nov 8, 2026
Merged

mozman merged 1 commit into
mozman:masterfrom
RavSinghChandan:mline-transform-scale

Conversation

@RavSinghChandan

Copy link
Copy Markdown
Contributor

Fixes #1457.

MLine.transform() only updated scale_factor when all three components of the transformed (s, s, s) vector were equal. So a uniform 2D scale (sz = 1, the usual scaled block reference) or a rotation with a scale kept the old scale_factor, and a mirror put the line elements of a one-sided style on the wrong side.

It now uses OCSTransform like CIRCLE and ARC: the extrusion is perpendicular to the transformed OCS x- and y-axis (so a mirror flips it), and the scale factor is multiplied by the in-plane scale when that scale is uniform. Non-uniform scaling is still ignored, as before.

The new test compares the transformed MLINE with its untransformed LINEs transformed one by one: 2D scale, rotation + scale, mirror x, mirror z and rotation + mirror + x100. 7 of the 10 cases from the issue were wrong on master, all match now. pytest tests passes and mypy is clean for the file.

Used Claude (Opus) to help find and patch this; I reviewed and tested the change

@mozman
mozman merged commit 16300f7 into mozman:master Nov 8, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MLine.transform() keeps a stale scale_factor under rotation, 2D scaling and mirroring, then regenerates wrong geometry from the style

2 participants