A newbie needs some help in squeak (maths,
algorithm and drawing)
Damien Cassou
damien.cassou at gmail.com
Thu Apr 26 14:33:15 UTC 2007
2007/4/26, Christophe Bouchard <Christophe.Bouchard at etu.univ-savoie.fr>:
> 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).
> ]
> "
What are (self sqrt:), (self cos:) and (self sin:)? Don't you mean:
spiral: len with: ppr
| theta r x y |
0 to: (len-1) do:
[:i | theta = 2* Float pi * i / ppr.
r = 0.15 * theta sqrt.
x = r * theta cos.
y = r * theta sin.
]
It still won't print anything to the screen however.
--
Damien Cassou
More information about the Squeak-dev
mailing list
|