-
March 9th, 2015, 08:55 AM
#1
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?
-
March 12th, 2015, 04:23 AM
#2
Re: reverse function
What are "physically" these LongitudeDeg, LatitudeDeg, LongitudeData, LatitudeData, l, u and v?
Victor Nijegorodov
-
March 12th, 2015, 08:53 AM
#3
Re: reverse function
Basic algebra....not really a programming question....
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|