[plt-scheme] Is this the correct behaviour for add-line?
It broke in front of 200 students today :-)
Any idea when it can be fixed? Can I help?
Chris
Matthias Felleisen wrote:
>
> On Dec 6, 2006, at 3:38 PM, Chris Stephenson wrote:
>
>> DrScheme Help says that the world.ss add-line function (unlike the
>> image.ss add-line) only draws the part of the line that lies within the
>> boundaries of the scene.
>>
>> So I thought trying to draw a very long line should not cause a problem
>> - it should simply be truncated.
>>
>> My experiments seem to show that this results in a "cannot make n x n
>> image" error, where n is the large co-ordinate of the line.
>
> Correct. I draw the line in the image and then shrink the image. I
> should do better -- Matthias
>
>
>
>> My test code is attached.
>>
>> Here is the output:
>> Welcome to DrScheme, version 360.
>> Language: Pretty Big (includes MrEd and Advanced Student).
>> Teachpack: /usr/lib/plt/collects/teachpack/htdp/world.ss.
>> #t
>> . cannot make 10001 x 10001 image
>>>
>>
>>
>>
>>
>> ;; data definition world
>> ;; canvas - what we are drawing on
>> ;; objects - a list of the images we are drawing
>> (define-struct world (canvas objects))
>>
>>
>> ;; data definition canvas
>> ;; scene: Scene
>> ;; width: number
>> ;; height: number
>> (define-struct canvas (scene width height))
>>
>> ;; draw
>> ;; World -> Scene
>> ;; place the images in the scene.
>> ;; template
>> ;; (lambda (w)
>> ;; (.... (world-canvas w)... (world-object w)...)
>> (define draw
>> (lambda (w)
>> (add-line (canvas-scene (world-canvas w)) 0 0 10000 10000 'black)))
>>
>> (big-bang 1000 680 0.1 (make-world (make-canvas (empty-scene 1000
>> 680) 1000 680)
>> null))
>> (on-redraw draw)
>> _________________________________________________
>> For list-related administrative tasks:
>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>