From a70aca317671403509d0c6f5ae90725309f49417 Mon Sep 17 00:00:00 2001 From: Neil Toronto Date: Sat, 4 Aug 2012 11:24:16 -0600 Subject: [PATCH] Fixed off-by-epsilon error; addresses issue with plateaus in contour-intervals and contour-intervals3d reported by Doug Williams Please merge into release --- collects/plot/common/marching-squares.rkt | 8 ++++---- collects/plot/tests/plot2d-tests.rkt | 8 ++++++++ collects/plot/tests/plot3d-tests.rkt | 8 ++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/collects/plot/common/marching-squares.rkt b/collects/plot/common/marching-squares.rkt index 657bc2fa24..4bed76be26 100644 --- a/collects/plot/common/marching-squares.rkt +++ b/collects/plot/common/marching-squares.rkt @@ -584,10 +584,10 @@ above. polys2220 polys2221 polys2222)) (define (unsafe-heights->polys za zb z1 z2 z3 z4) - (define t1 (if (z1 . unsafe-fl< . za) 0 (if (z1 . unsafe-fl< . zb) 1 2))) - (define t2 (if (z2 . unsafe-fl< . za) 0 (if (z2 . unsafe-fl< . zb) 1 2))) - (define t3 (if (z3 . unsafe-fl< . za) 0 (if (z3 . unsafe-fl< . zb) 1 2))) - (define t4 (if (z4 . unsafe-fl< . za) 0 (if (z4 . unsafe-fl< . zb) 1 2))) + (define t1 (if (z1 . unsafe-fl< . za) 0 (if (z1 . unsafe-fl<= . zb) 1 2))) + (define t2 (if (z2 . unsafe-fl< . za) 0 (if (z2 . unsafe-fl<= . zb) 1 2))) + (define t3 (if (z3 . unsafe-fl< . za) 0 (if (z3 . unsafe-fl<= . zb) 1 2))) + (define t4 (if (z4 . unsafe-fl< . za) 0 (if (z4 . unsafe-fl<= . zb) 1 2))) (define facet-num (unsafe-fx+ (unsafe-fx+ (unsafe-fx+ (unsafe-fx* (unsafe-fx* (unsafe-fx* t1 3) 3) 3) (unsafe-fx* (unsafe-fx* t2 3) 3)) diff --git a/collects/plot/tests/plot2d-tests.rkt b/collects/plot/tests/plot2d-tests.rkt index 58372caae2..880ec650fc 100644 --- a/collects/plot/tests/plot2d-tests.rkt +++ b/collects/plot/tests/plot2d-tests.rkt @@ -308,6 +308,14 @@ (time (plot (contour-intervals f1 -5 5 -5 5 #:label "z"))) +(time (plot (contour-intervals + (λ (x y) + (define z (- x y)) + (cond [(< z -1) -1] + [(> z 1) 1] + [else z])) + -2 2 -2 2))) + (time (plot (list (tick-grid) (contour-intervals f1 -5 2 -5 2 #:levels 5 diff --git a/collects/plot/tests/plot3d-tests.rkt b/collects/plot/tests/plot3d-tests.rkt index 8182229c66..65252103c6 100644 --- a/collects/plot/tests/plot3d-tests.rkt +++ b/collects/plot/tests/plot3d-tests.rkt @@ -189,6 +189,14 @@ (time (plot3d (contour-intervals3d f5 -4 4 -4 4 #:label "z"))) +(time (plot3d (contour-intervals3d + (λ (x y) + (define z (- x y)) + (cond [(< z -1) -1] + [(> z 1) 1] + [else z])) + -2 2 -2 2))) + (time (plot3d (contour-intervals3d (λ (x y) (+ x y))) #:x-min #e100000000000000.0 #:x-max #e100000000000000.1