From: Bruce S. <Bru...@nc...> - 2008-01-02 16:55:51
|
I've just posted a corrected version of pixelplot.py in the contributed section of vpython.org. I made an off-by-one error in "connecting the dots" in the curves that are used with the production version of VPython. The effect was to blend/blur adjacent colors rather than make them distinct as intended. Bruce Sherwood > ----------------------- > A colleague asked me about pixel-oriented plotting in VPython, for doing > such things as chaos-related plots. I replied that there really isn't > good support for that in the production version of VPython, though the > new "points" object in the beta version is appropriate. > > But then I realized that there is something one can do: Create a stack > of horizontal lines (curve objects) and set colors at points that way. > It works, and in the contributed section of vpython.org there is now a > little program pixelplot.py which makes a display of the famous > Mandelbrot set. The program also checks to see whether there is a > "points" object available and uses that, which is faster and simpler. > > There's a slightly tricky issue when using curves, which is explained in > the documentation for curve. Colors are interpolated between points. So > to make the right color at a point, you have to stick in an extra point. > So 4 pixels requires 8 points on the curve: 0-1, 1-2, 2-3, 3-4. > > Bruce Sherwood > > P.S. In the process I found that there are bugs in the points object. It > dies when you try to append more than 33000 points. Dunno why yet. But > this doesn't affect the posted program. > > > |