[Haskell-cafe] approximating pi

Steve Schafer steve at fenestra.com
Wed Apr 30 11:31:02 EDT 2008


On Tue, 29 Apr 2008 22:12:28 -0700 (PDT), you wrote:

>I was thinking of how to represent this process graphically on a
>computer screen.

The way to do this is to keep in mind that the display is only a
_representation_ of the algorithm in action, it is not involved in the
actual algorithm. The screen resolution is immaterial to the operation
of the algorithm, which is just dealing with numbers. For every
iteration of the algorithm, there should be a notification sent to the
code that controls the display, and that code needs to know how to
update the screen accordingly.

For example, it could be that the algorithm point (0.31416,0.27183) maps
to pixel (45,127) on the screen. The update code might examine that
pixel and increment its intensity, or change its color, or any of a
number of other things that would indicate that the pixel had been
"hit." Note that multiple algorithm points will necessarily map to the
same screen pixel.

Steve Schafer
Fenestra Technologies Corp.
http://www.fenestra.com/


More information about the Haskell-Cafe mailing list