Fixed off-by-epsilon error; addresses issue with plateaus in contour-intervals and contour-intervals3d reported by Doug Williams

Please merge into release
This commit is contained in:
Neil Toronto 2012-08-04 11:24:16 -06:00
parent 579e5d3c87
commit a70aca3176
3 changed files with 20 additions and 4 deletions

View File

@ -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))

View File

@ -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

View File

@ -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