From 054c811b494746ec7304c3d495675046727ab114 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 21 Jun 2017 23:53:53 +0000 Subject: [PATCH] Change dilated to take one parameter. Function is nearly unused, so I'm not concerned about breakage. This new version better aligns with standard educational usage, in which "dilation" means uniform scaling. Taken as a separate operation, it commutes with rotation, and preserves similarity of shapes, neither of which is true of scaling in general. --- codeworld-api/src/CodeWorld/Picture.hs | 4 ++-- codeworld-base/src/Internal/Picture.hs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/codeworld-api/src/CodeWorld/Picture.hs b/codeworld-api/src/CodeWorld/Picture.hs index fe2bd0970..ea8d34e82 100644 --- a/codeworld-api/src/CodeWorld/Picture.hs +++ b/codeworld-api/src/CodeWorld/Picture.hs @@ -181,8 +181,8 @@ scaled :: Double -> Double -> Picture -> Picture scaled = Scale -- | A picture scaled by these factors. -dilated :: Double -> Double -> Picture -> Picture -dilated = scaled +dilated :: Double -> Picture -> Picture +dilated k = scaled k k -- | A picture rotated by this angle. -- diff --git a/codeworld-base/src/Internal/Picture.hs b/codeworld-base/src/Internal/Picture.hs index efb12f54e..14780cbec 100644 --- a/codeworld-base/src/Internal/Picture.hs +++ b/codeworld-base/src/Internal/Picture.hs @@ -184,8 +184,8 @@ scaled :: (Picture, Number, Number) -> Picture scaled (p, x, y) = CWPic (CW.scaled (toDouble x) (toDouble y) (toCWPic p)) -- | A picture scaled by these factors. -dilated :: (Picture, Number, Number) -> Picture -dilated = scaled +dilated :: (Picture, Number) -> Picture +dilated (p, k) = CWPic (CW.dilated (toDouble k) (toCWPic p)) -- | A picture rotated by this angle. rotated :: (Picture, Number) -> Picture