# HG changeset patch # User Steve Losh # Date 1560098759 14400 # Node ID 425689e66be84600f3f5c4d7d46ac9b9c6a4a1d5 # Parent 4b63cff9f91247f25f0f03015920883d7e4ab311 Fix non-square circle transformations diff -r 4b63cff9f912 -r 425689e66be8 src/drawing/api.lisp --- a/src/drawing/api.lisp Sun Jun 09 12:16:43 2019 -0400 +++ b/src/drawing/api.lisp Sun Jun 09 12:45:59 2019 -0400 @@ -178,7 +178,15 @@ (defmethod ntransform ((circle circle) transformation) (ntransform (center circle) transformation) - (zapf (radius circle) (ntransform % transformation)) + ;; For non-aspect-ratio-preserving transformations, we want to keep circles + ;; as circles, but ensure they fit within the new bounding box. So we take + ;; the smaller of the two possible radius transformations. + (let ((a (vec 0 0 1)) + (b (vec 1 1 1))) + (ntransform a transformation) + (ntransform b transformation) + (let ((c (v- a b))) + (mulf (radius circle) (min (abs (vx c)) (abs (vy c)))))) circle)