Fix wrongly raised exception when 3D rectangles are entirely clipped out

This commit is contained in:
Neil Toronto 2014-04-05 11:40:23 -06:00
parent f00da37186
commit 6a73b6b9ec
3 changed files with 10 additions and 2 deletions

View File

@ -1033,8 +1033,8 @@
norm-vs ls normal))))))) norm-vs ls normal)))))))
(define/public (put-rect r) (define/public (put-rect r)
(when (rect-rational? r) (let ([r (if (rect-rational? r) (rect-meet r bounds-rect) r)])
(let ([r (rect-meet r bounds-rect)]) (when (rect-rational? r)
(match-define (vector (ivl x-min x-max) (ivl y-min y-max) (ivl z-min z-max)) r) (match-define (vector (ivl x-min x-max) (ivl y-min y-max) (ivl z-min z-max)) r)
(define v-min (plot->norm (vector (inexact->exact x-min) (define v-min (plot->norm (vector (inexact->exact x-min)
(inexact->exact y-min) (inexact->exact y-min)

View File

@ -18,6 +18,10 @@
(time (time
(plot (points empty) #:x-min -1 #:x-max 1 #:y-min -1 #:y-max 1)) (plot (points empty) #:x-min -1 #:x-max 1 #:y-min -1 #:y-max 1))
(printf "Plot should be empty:~n")
(plot (rectangles (list (list (ivl 0 1) (ivl 0 1))))
#:x-min 2 #:x-max 3)
(plot (list (function values -4 4) (axes 1 2))) (plot (list (function values -4 4) (axes 1 2)))
(time (plot (function values 0 1000))) (time (plot (function values 0 1000)))

View File

@ -11,6 +11,10 @@
(time (time
(plot3d (points3d empty) #:x-min -1 #:x-max 1 #:y-min -1 #:y-max 1 #:z-min -1 #:z-max 1)) (plot3d (points3d empty) #:x-min -1 #:x-max 1 #:y-min -1 #:y-max 1 #:z-min -1 #:z-max 1))
(printf "This plot should be empty:~n")
(plot3d (rectangles3d (list (list (ivl 0 1) (ivl 0 1) (ivl 0 1))))
#:x-min 2 #:x-max 3)
(parameterize ([plot-background "black"] (parameterize ([plot-background "black"]
[plot-foreground "white"] [plot-foreground "white"]
[plot-background-alpha 1/2] [plot-background-alpha 1/2]