Private Const PI = 3.1415927
Private Const degtorad = 0.0174532
Private Const radtodeg = 57.29577951
Private Type tyRcoord
x As Double
y As Double
End Type
Private Type tyPcoord
R As Double
theta As Double
End Type
Sub parabola_segments()
Dim vc As tyRcoord
Dim pc As tyPcoord
Dim i As Integer
Dim n As Integer
Dim theta As Double
Dim s As String
s = InputBox("Number of units to evaluate", , 12)
n = CInt(s)
s = InputBox("Angle of axes", , 90)
theta = CDbl(s) * degtorad
pc.theta = theta
For i = 0 To n
pc.R = n - i
vc = polar_to_rectang(pc)
ActiveDrawing.Graphics.AddLineSingle i, 0, 0, vc.x, vc.y, 0
ActiveDrawing.Graphics.AddText CStr(i), i, -1, 0, 0.4
ActiveDrawing.Graphics.AddText CStr(i), vc.x - 1, vc.y, 0, 0.4
Next i
End Sub
Private Function polar_to_rectang(p As tyPcoord) As tyRcoord
polar_to_rectang.x = p.R * Cos(p.theta)
polar_to_rectang.y = p.R * Sin(p.theta)
End Function
Private Function rectang_to_polar(v As tyRcoord) As tyPcoord
rectang_to_polar.R = Sqr(v.x ^ 2 + v.y ^ 2)
If v.y <> 0 And v.x <> 0 Then
rectang_to_polar.theta = Atn(v.y / v.x)
End If
If v.y = 0 Then rectang_to_polar.theta = 0
If v.x = 0 Then rectang_to_polar.theta = 1000000#
End Function