Archimedes’ Spiral

Archimedes’ spiral  : R = kA

Capture_11-2-2015-1

the program is the same we have been using.

Sub arch_spiral()
'R = BA
Call init_polar
Dim B As Double
B = frm_polar.txt_b3.Value

Dim R As Double, A As Integer
Dim X As Double, Y As Double
Dim A_rad As Double
Dim i As Integer, numpts As Integer
Dim plineobj As AcadLWPolyline
Dim pt() As Double

numpts = (Amax - Amin) / A_inc 'num of lines
numpts = numpts + 1
ReDim pt(1 To numpts * 2)

For i = 1 To numpts
A = Amin + ((i - 1) * A_inc)
A_rad = deg2rad(A)

'this is the function
R = B * A_rad

X = R * Cos(A_rad)
Y = R * Sin(A_rad)
pt(i * 2 - 1) = X: pt(i * 2) = Y
Next i

Set plineobj = acadDoc.ModelSpace.AddLightWeightPolyline(pt)
Update
strLabel = "R= " & B & " * A"
Call label_graph
End Sub

Capture_11-3-2015-2

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s