Given length, taper and angle the values A and B are forced.
This draws a sequence of triangles, each consisting of one white side and two gray sides.
The triangles are similar. Each is like its predecessor, but with all sides multiplied by taper#.
Each triangle has one vertex on the logarithmic spiral.
NOTE: I've just made a change to the equation for A, which I had copied incorrectly from my notes.
In the example program the value of A turns out to be irrelevant.
It is the length of the first (theta=0) edge of the first triangle.
But the code scales everything to fit on the screen.
The first edge is drawn as if A were 420, no matter what A really is.
Global length# = 16.0 Global taper# = 0.95 ; 0.85 to 0.95 produce nice looking sprirals Global angle# = 22.5 ; Logarithmic spiral: r = A * Exp( B * theta ) Global A# = length / Sqr( 1.0 + taper^2 - 2*taper*Cos(angle) ) Global B# = Log( taper ) / angle Graphics 800, 600, 0, 1 Origin 300, 350 DrawSpiral DrawTriangles WaitKey : End Function DrawPixel( x#, y# ) s# = 420.0 / A Plot x*s, -y*s End Function Function DrawLine( x1#,y1#, x2#,y2# ) s# = 420.0 / A Line x1*s, -y1*s, x2*s, -y2*s End Function Function DrawSpiral() Color 150,150,0 For theta# = 0 To 9*360 Step 0.1 r# = A * Exp( B * theta ) x# = r * Cos( theta ) y# = r * Sin( theta ) DrawPixel x, y Next End Function Function DrawTriangles() x1# = A : y1# = 0.0 Color 50,50,50 drawline 0,0, x1,y1 r# = A For n = 1 To 270 / angle theta# = n * angle r = r * taper x2# = r * Cos(theta) y2# = r * Sin(theta) Color 255,255,255 Drawline x1,y1, x2,y2 x1 = x2 y1 = y2 Color 50,50,50 drawline 0,0, x1,y1 Next End Function
This draws a sequence of triangles, each consisting of one white side and two gray sides.
The triangles are similar. Each is like its predecessor, but with all sides multiplied by taper#.
Each triangle has one vertex on the logarithmic spiral.
NOTE: I've just made a change to the equation for A, which I had copied incorrectly from my notes.
In the example program the value of A turns out to be irrelevant.
It is the length of the first (theta=0) edge of the first triangle.
But the code scales everything to fit on the screen.
The first edge is drawn as if A were 420, no matter what A really is.