On 05/22/2012 09:05 PM, Neil Toronto wrote:
On 05/22/2012 02:41 AM, Jens Axel Søgaard wrote:
Since the contract for plot requires I must use numbers,
I attempted to split the domain in two from -1 to -epsilon
and from +epsilon to 1.

That trick didn't work (see attached image).

Am I missing something?

You're not missing anything. There's currently a problem with the
renderers returned by `function', `surface3d' and others: they sample
functions on the entire plotted domain, not just within the functions'
stated domains. To split a function in half and not have it draw a line
between the halves, you currently have to do something like this:

(plot (list (function (λ (x) (if (x . < . 0) (/ x) +nan.0)) -2 0)
(function (λ (x) (if (x . > . 0) (/ x) +nan.0)) 0 2)))

This also causes performance problems when there are many small function
renderers. Fixing it is next on my to-do list.

I just pushed a fix for this. The following now works as you'd expect:

#lang racket

(require plot)

(plot (list (function (compose / exact->inexact) -1 0)
            (function (compose / exact->inexact) 0 1)))

(plot (list (function / -1 -0.01)
            (function / 0.01 1)))

Neil ⊥
____________________
 Racket Users list:
 http://lists.racket-lang.org/users

Reply via email to