Archimedean spiral: Difference between revisions
Content added Content deleted
(Frink) |
(adding lambdatalk task) |
||
Line 1,617: | Line 1,617: | ||
} |
} |
||
}</syntaxhighlight> |
}</syntaxhighlight> |
||
=={{header|Lambdatalk}}== |
|||
<syntaxhighlight lang="Scheme"> |
|||
1) from polar to cartesian coordinates |
|||
x = r*cos(t) = (a+b*t)*cos(t) |
|||
y = r*sin(t) = (a+b*t)*sin(t) |
|||
2) define the curve |
|||
{def CURVE |
|||
{lambda {:a :b :t} |
|||
{* {+ :a {* :b :t}} {cos :t}} |
|||
{* {+ :a {* :b :t}} {sin :t}} |
|||
}} |
|||
-> CURVE |
|||
3) and draw it using SVG |
|||
{{SVG 580} |
|||
{g {AXES 580 580} |
|||
{polyline {@ points="{S.map {CURVE 5 4} |
|||
{S.serie 0 {* 10 {PI}} 0.1}}" |
|||
{stroke red 3}} |
|||
}}} |
|||
</syntaxhighlight> |
|||
The ouput can be seen in http://lambdaway.free.fr/lambdawalks/?view=archimedian_spiral |
|||
=={{header|Lua}}== |
=={{header|Lua}}== |