A newbie needs some help in squeak (maths, algorithm and drawing)
Christophe Bouchard
Christophe.Bouchard at etu.univ-savoie.fr
Thu Apr 26 14:26:44 UTC 2007
Hello,
I have to realize an application in squeak which is an icon generator. My questions are the following:
I have an algorithm which describe a spiral and i'd like to transcript it into squeak, but it doesn't work.
The original algorithm is:
" for( i=0; i < len; i++ ) {
theta = 2*pi*float(i) / ppr;
r = 0.15 * sqrt(theta);
x = r * cos(theta);
y = r * sin(theta);
}
"
And what i've done but that doesn't work:
"
spiral: len with: ppr
| theta r x y |
0 to: (len-1) do:
[:i | theta = 2* Float pi * i / ppr.
r = 0.15 * (self sqrt: theta).
x = r * ( self cos: theta).
y = r * ( self sin: theta).
]
"
But this code doesn't work and I don't know how to code my spiral algorithm and how it will be displayed on screen when running.
Thank you for your help.
Chris
More information about the Squeak-dev
mailing list
|