CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

1. Member
Join Date
May 2014
Posts
205

## reverse function

Hello,

I have code for conversion of longitude and latitude and I need help to reverse the function so it will work in opposite direction:

Code:
float LongitudeDeg = argv[1]; // some longitude
float LatitudeDeg = argv[2]; // some latitude
uint32_t u,v,l,n;
l=15; // l range is 2-29

LongitudeData = int(0.5 + (180 + LongitudeDeg) * (0x2000000 / 15));
LatitudeData = int(0.5 + (90 - LatitudeDeg) * (0x8000000 / 45));

if ( LongitudeData > 0x30000000)
LongitudeData -= 0x30000000;
if (LongitudeData < 0)
LongitudeData += 0x30000000

if ( LatitudeData > 0x20000000 )
LatitudeData -= 0x20000000;
if ( LatitudeData < 0 )
LatitudeData += 0x20000000);

n = 30 - l;
u = LongitudeData >> n;
v = LatitudeData >> n;
On start of the code we know longitude,latitude and l. And the result is u and v. And I need function when I will know the u and v, possibly l too, to calculate longitude, latitude.

Can you help with it?

2. ## Re: reverse function

What are "physically" these LongitudeDeg, LatitudeDeg, LongitudeData, LatitudeData, l, u and v?

3. ## Re: reverse function

Basic algebra....not really a programming question....

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•