From 1034576bfe3b56f166c65373968c3b1358181bef Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Sat, 13 May 2017 18:45:17 -0700 Subject: [PATCH] restrict numerical precision --- pitfall/pitfall/kit/vector.rkt | 5 +++-- pitfall/pktest/test1rkt.pdf | 18 +++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/pitfall/pitfall/kit/vector.rkt b/pitfall/pitfall/kit/vector.rkt index f99c6c01..f8004f5d 100644 --- a/pitfall/pitfall/kit/vector.rkt +++ b/pitfall/pitfall/kit/vector.rkt @@ -42,7 +42,8 @@ (public [@bezierCurveTo bezierCurveTo]) (define (@bezierCurveTo cp1x cp1y cp2x cp2y x y) - (send this addContent (format "~a ~a ~a ~a ~a ~a c" cp1x cp1y cp2x cp2y x y))) + (send this addContent (format "~a c" + (string-join (map number (list cp1x cp1y cp2x cp2y x y)) " ")))) (public [@ellipse ellipse]) @@ -115,7 +116,7 @@ [(list (? number? xFactor)) (@scale xFactor (mhash))] [(list (? number? xFactor) (? hash? options)) (@scale xFactor xFactor options)] [(list (? number? xFactor) (? number? yFactor)) (@scale xFactor yFactor (mhash))] - [(list (? number? xFactor) (? number? yFactor) (? hash? options)) + [(list (? number? xFactor) (? number? yFactor) (? hash? options)) (define x 0) (define y 0) (when (hash-ref options 'origin #f) (match-define (list x y) (hash-ref options 'origin)) diff --git a/pitfall/pktest/test1rkt.pdf b/pitfall/pktest/test1rkt.pdf index 203d2f78..5f685a21 100644 --- a/pitfall/pktest/test1rkt.pdf +++ b/pitfall/pktest/test1rkt.pdf @@ -16,7 +16,7 @@ endobj endobj 3 0 obj << -/Length 344 +/Length 280 >> stream 1 0 0 -1 0 792 cm @@ -29,10 +29,10 @@ q f 230 200 m -230 172.38576250846032 252.38576250846032 150 280 150 c -307.61423749153965 150 330 172.38576250846032 330 200 c -330 227.61423749153968 307.61423749153965 250 280 250 c -252.38576250846032 250 230 227.61423749153968 230 200 c +230 172.385763 252.385763 150 280 150 c +307.614237 150 330 172.385763 330 200 c +330 227.614237 307.614237 250 280 250 c +252.385763 250 230 227.614237 230 200 c h /DeviceRGB cs 0.4 0 1 scn @@ -64,12 +64,12 @@ endobj xref 0 7 0000000000 65535 f -0000000730 00000 n -0000000681 00000 n +0000000666 00000 n +0000000617 00000 n 0000000186 00000 n 0000000119 00000 n 0000000015 00000 n -0000000581 00000 n +0000000517 00000 n trailer << /Info 6 0 R @@ -77,5 +77,5 @@ trailer /Size 7 >> startxref -787 +723 %%EOF