SI
SI
discoversearch

We've detected that you're using an ad content blocking browser plug-in or feature. Ads provide a critical source of revenue to the continued operation of Silicon Investor.  We ask that you disable ad blocking while on Silicon Investor in the best interests of our community.  If you are not using an ad blocker but are still receiving this message, make sure your browser's tracking protection is set to the 'standard' level.
Strategies & Market Trends : Bonds, Currencies, Commodities and Index Futures

 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext  
To: M3SMG who wrote (11266)5/9/2006 6:21:29 AM
From: Jack of All Trades   of 12411
 
If your brother did write the code to get it to draw using arcs then all he needs to do is trig out the arc start and stop pt's by using this code based on the quadrant the arc is in...

Sorry for the lack of comments on the code, but he should be able to figure it out. Here are the 90 and 180 deg draws...

Public Function DrawSpiral90(ByVal CX As Double, ByVal CY As Double, ByVal theta As Double, ArcColor As Double, scaleinc As Integer, invert As Boolean) As Boolean
Dim F, F1, F2, F3, F4 As Double
Dim x1, y1, x2, y2, x3, y3, x4, y4 As Double
Dim PI As Double
PI = 3.14159265358979
theta = theta * PI / 180
x1 = CX
y1 = CY
frmGraphic.Circle (x1, y1), 1, ArcColor / 2, theta, theta + PI * 0.5

F = 1

While F < 250
F1 = F + F3
F2 = F1 + F
F3 = F2 + F1
F4 = F3 + F2

If invert = False Then
frmGraphic.Circle (x1, y1), F1, ArcColor, theta, theta + PI * 0.5
x2 = x1 - Cos(theta) * F
y2 = y1 + Sin(theta) * F
frmGraphic.Circle (x2, y2), F2, ArcColor, PI * 1.5 + theta, theta
x3 = x2 - Sin(theta) * F1
y3 = y2 - Cos(theta) * F1
frmGraphic.Circle (x3, y3), F3, ArcColor, PI + theta, PI * 1.5 + theta
x4 = x3 + Cos(theta) * F2
y4 = y3 - Sin(theta) * F2
frmGraphic.Circle (x4, y4), F4, ArcColor, PI * 0.5 + theta, PI + theta
x1 = x4 + Sin(theta) * F3
y1 = y4 + Cos(theta) * F3
Else:
frmGraphic.Circle (x1, y1), F1, ArcColor, theta, PI * 0.5 + theta
x2 = x1 + Sin(theta) * F
y2 = y1 + Cos(theta) * F
frmGraphic.Circle (x2, y2), F2, ArcColor, PI * 0.5 + theta, PI + theta
x3 = x2 + Cos(theta) * F1
y3 = y2 - Sin(theta) * F1
frmGraphic.Circle (x3, y3), F3, ArcColor, PI + theta, PI * 1.5 + theta
x4 = x3 - Sin(theta) * F2
y4 = y3 - Cos(theta) * F2
frmGraphic.Circle (x4, y4), F4, ArcColor, PI * 1.5 + theta, theta
x1 = x4 - Cos(theta) * F3
y1 = y4 + Sin(theta) * F3
End If
F = F4
Wend
End Function
Public Function DrawSpiral180(ByVal CX As Double, ByVal CY As Double, ByVal theta As Double, ArcColor As Double, scaleinc As Integer, invert As Boolean) As Boolean
Dim F, F1, F2, F3, F4 As Double
Dim x1, y1, x2, y2, x3, y3, x4, y4 As Double
Dim PI As Double
PI = 3.14159265358979
theta = theta - 90
theta = theta * PI / 180
x1 = CX
y1 = CY
frmGraphic.Circle (x1, y1), 1, ArcColor / 2, theta, theta + PI * 0.5

F = 1

While F < 250

F1 = F + F3
F2 = F1 + F
F3 = F2 + F1
F4 = F3 + F2

If invert = False Then
frmGraphic.Circle (x1, y1), F1, ArcColor, PI * 0.5 + theta, PI + theta
x2 = x1 + Sin(theta) * F
y2 = y1 + Cos(theta) * F
frmGraphic.Circle (x2, y2), F2, ArcColor, theta, theta + PI * 0.5
x3 = x2 - Cos(theta) * F1
y3 = y2 + Sin(theta) * F1
frmGraphic.Circle (x3, y3), F3, ArcColor, PI * 1.5 + theta, theta
x4 = x3 - Sin(theta) * F2
y4 = y3 - Cos(theta) * F2
frmGraphic.Circle (x4, y4), F4, ArcColor, PI + theta, PI * 1.5 + theta
x1 = x4 + Cos(theta) * F3
y1 = y4 - Sin(theta) * F3
Else:
frmGraphic.Circle (x1, y1), F1, ArcColor, PI * 0.5 + theta, PI + theta
x2 = x1 + Cos(theta) * F
y2 = y1 - Sin(theta) * F
frmGraphic.Circle (x2, y2), F2, ArcColor, PI + theta, PI * 1.5 + theta
x3 = x2 - Sin(theta) * F1
y3 = y2 - Cos(theta) * F1
frmGraphic.Circle (x3, y3), F3, ArcColor, PI * 1.5 + theta, theta
x4 = x3 - Cos(theta) * F2
y4 = y3 + Sin(theta) * F2
frmGraphic.Circle (x4, y4), F4, ArcColor, theta, PI * 0.5 + theta
x1 = x4 + Sin(theta) * F3
y1 = y4 + Cos(theta) * F3

End If
F = F4
Wend
End Function
Report TOU ViolationShare This Post
 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext