Maths/C Question

Soldato
Joined
22 Oct 2005
Posts
2,884
Location
Moving...
Could someone help me out with the following equation please. I'm trying to calculate the following equation in C:

Code:
                             1
C =   ---------------------------------------------------
         sqrt( cos^2(latitude) + (1-f)^2 * sin^2(latitude) )


First off, is there a function in C to do cos or sin^2(x)? I coulnd't find one, just the ordinary sin/cos functions.

Because I couldn't find out how to do that, I used the following trig identities which I found:

Code:
cos^2(x) = 1/2 + 1/2 cos(2x)
and
sin^2(x) = 1/2 - 1/2 cos(2x)

Are these correct?

Thanks for any help!
 
Last edited:
Sorry I'm being a massive spanner. The function works fine now. I just can't tell the difference between longitude and latitude :o:o:o.

The first question still stands though, is there a function for sin/cos^2(x)?

Cheers.
 
Back
Top Bottom