Archimedean spiral: Difference between revisions

Content added Content deleted
No edit summary
Line 233: Line 233:
********
********
</pre>
</pre>

=={{header|Amazing Hopper}}==
{{Trans|AmigaBASIC}}
<syntaxhighlight lang="apl">
#include <jambo.h>

Main
Set break
a=1.5, b=1.5, r=0, origen x=200, origen y=105
total = 0, Let ( total := Mul(20, M_PI) )
Cls
Loop for ( t=0, var 't' Is less equal to 'total', Let (t := Add (t, 0.005)) )
#( r = a + b * t )
Set 'origen x, origen y', # ( 200 + (2*r*sin(t)) ) » 'origen x', #( 105 + (r*cos(t)) ) » 'origen y',
Gosub 'Dibuja un segmento'
Next
Pause
End

Subrutines

Define (Dibuja un segmento, x1, y1, x2, y2)
dx=0, dy=0, paso=0, i=0, DX=0, DY=0

Sub(x2, x1), Sub (y2, y1), Move to ' dx, dy '

Let( paso := Get if( Greater equal ( Abs(dx) » (DX), Abs(dy)»(DY) ), DX, DY ) )

// incremento:
Div(dx, paso), Div(dy, paso), Move to ( dx, dy )

Color back (13)
// dibuja línea:
i = 0
Loop if ( Less equal (i, paso), ++i )
Locate( y1, x1 ), Printnl( " " )
Add ( x1, dx), Add( y1, dy ), Move to ( x1, y1 )
++i
Back
Printnl("\OFF")
Return

</syntaxhighlight>
{{out}}
<pre>
Invocar como:
rxvt -g 500x250 -fn "xft:FantasqueSansMono-Regular:pixelsize=1" -e hopper jm/archi.jambo
</pre>

[[File:Captura_de_pantalla_de_2022-10-07_22-57-32.png]]


=={{header|APL}}==
=={{header|APL}}==