WeBWorK Main Forum

Smoother Dynamic Image

Re: Smoother Dynamic Image

by Davide Cervone -
Number of replies: 0
Note that you have specified an image size of 150 x 150 in
$gr1 = init_graph(-4,-4,4,4,
but then ask for an image to be used at 300 x 300 pixels in
$fig1 = image(insertGraph($gr1),
So that means that the image will be forced to be displayed at twice its actual size, which will look really bad. Matching the two dimensions will help.

Also note that making the function use 5000 steps is considerable overkill, since you only have 150 pixels in either direction. You would need 5000 pixels to make 500 steps be useful. You are just wasting processing time redrawing the same pixel over and over again.