Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB Java
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 24-Nov-12 13:00pm
Adi Miz110
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

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? Smile | :)
  Permalink  
Comments
Adi Miz at 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)

  Print Answers RSS
0 OriginalGriff 490
1 Maciej Los 299
2 BillWoodruff 174
3 /\jmot 170
4 Suraj Sahoo | Coding Passion 150
0 OriginalGriff 8,484
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,159
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 25 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100