12,403,130 members (69,923 online)
Rate this:
See more:
```Function ParallaxHA(HH As Double, HM As Double, HS As Double, DD As Double, DM As Double, DS As Double, SW As String, GP As Double, HT As Double, HP As Double) As Double

A = Radians(GP): C1 = Cos(A): S1 = Sin(A)
U = Atn(0.996647 * S1 / C1)
C2 = Cos(U): S2 = Sin(U): B = HT / 6378160#
RS = (0.996647 * S2) + (B * S1)
RC = C2 + (B * C1): TP = 6.283185308

X = Radians(DHDD(HMSDH(HH, HM, HS))): X1 = X
Y = Radians(DMSDD(DD, DM, DS)): Y1 = Y

If ((Left\$(SW, 1) = "T") Or (Left\$(SW, 1) = "t")) Then
D = 1#
Else
D = -1#
End If

If (D = 1) Then
GoSub 2870
GoTo 2895
End If

P1 = 0: Q1 = 0
2845    GoSub 2870: P2 = P - X: Q2 = Q - Y
AA = Abs(P2 - P1): BB = Abs(Q2 - Q1)

If ((AA < 0.000001) And (BB < 0.000001)) Then
P = X1 - P2: Q = Y1 - Q2: X = X1: Y = Y1
GoTo 2895
End If

X = X1 - P2: Y = Y1 - Q2: P1 = P2: Q1 = Q2: GoTo 2845

2870    CX = Cos(X): SY = Sin(Y): CY = Cos(Y)
AA = (RC * Sin(X)) / ((RP * CY) - (RC * CX))
DX = Atn(AA): P = X + DX: CP = Cos(P)
P = P - TP * Int(P / TP)
Q = Atn(CP * (RP * SY - RS) / (RP * CY * CX - RC))
Return

2895    ParallaxHA = DDDH(Degrees(P))```
Posted 24-Nov-12 12:00pm
Updated 24-Nov-12 19:23pm
v2

Rate this:

## Solution 1

By reading the code line by line and converting it to equivalent java constructs and language syntax.

Looks like there is also some refactoring that can be achieved as well to get rid of the gosubs.

You didn't expect someone to do it for you did you?

well, please do this for me if you can :)))) .. hahaha for me goto and gosubs are hell ..

Top Experts
Last 24hrsThis month
 Karthik Bangalore 360 OriginalGriff 298 Richard MacCutchan 181 Suvendu Shekhar Giri 175 Richard Deeming 173
 OriginalGriff 7,311 ppolymorphe 3,080 Karthik Bangalore 3,012 Richard MacCutchan 2,300 F-ES Sitecore 2,187