OK next step in story is me trying to get closer to a Spirograph than Ashish:
Here is my first effort 5 years ago almost:
Me thinks if Walter had posted his after Ashish or mine, neither of us would have pursued Spirograph further! ;-))
Here is my first effort 5 years ago almost:
Code: (Select All)
_Title "Test 1 Spirograph" ' b+ trans from SB 2022-05-10
'Spirograph test.bas SmallBASIC 0.12.9 (B+=MGA) 2017-07-01
xmax = 700: ymax = 700
Screen _NewImage(xmax, ymax, 12) ' using 16 colors
_ScreenMove 300, 20
Dim Shared pi
pi = _Pi
rO = ymax / 2 - 10 ' fit screen radius of big circle
rI = rO / 2 ' smaller circle that travels inside edge of larger
OI = rO / rI ' rate inner circle spins compared to angle on outer circle
'? OI
Ox = xmax / 2
Oy = ymax / 2
Dim Shared px(20000), py(20000), pIndex
For a = 0 To 2 * pi Step pi / 360 'while the inner circle contacts outer at angle a
Cls
Circle (Ox, Oy), rO, 9
'the origin of inner circle at same angle
Ix = Ox + (rO - rI) * Cos(a)
Iy = Oy + (rO - rI) * Sin(a)
Ia = OI * a 'the angle of the inner points are OI * a on outer circle
'draw line from origin of inner circle to outer edge
Color 12
wheel Ix, Iy, rI, -Ia
For i = 1 To pIndex - 1
PSet (px(i), py(i)), 15
Next
_Display
_Delay .010
Next
Sub wheel (x, y, r, a)
'local i, x1, y1
Circle (x, y), r
For i = 1 To 12
x1 = x + r * Cos(i * 2 * pi / 12 + a)
y1 = y + r * Sin(i * 2 * pi / 12 + a)
Line (x, y)-(x1, y1)
If i = 12 Then
x2 = x + r / 2 * Cos(i * 2 * pi / 12 + a)
y2 = y + r / 2 * Sin(i * 2 * pi / 12 + a)
px(pIndex) = x2
py(pIndex) = y2
pIndex = pIndex + 1
End If
Next
End Sub
Me thinks if Walter had posted his after Ashish or mine, neither of us would have pursued Spirograph further! ;-))
b = b + ...