Click here to Skip to main content
15,881,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
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

        RP = 1 / Sin(Radians(HP))
        
        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
v2

1 solution

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? :)
 
Share this answer
 
Comments
Adi Miz 25-Nov-12 3:29am    
well, please do this for me if you can :)))) .. hahaha for me goto and gosubs are hell ..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900