- #1
k_squared
- 64
- 0
I was writing a program to place a markers on a map of the United States, for a Civil War battlemap generator. I tried this:
Assuming x,y and lat/long are superimposed yet different coordinate systems. For example, if a coordinate system with a unary equivalent to 12 on the other were to exist, express two concurrent points. Then use the distance formula:
sqrt( (24+12)^2+(24+12)^2)/sqrt ( (2+1)^2+(2+1)) = 12 (as do all other concurrent values.)
I found pixel where the four corners states meet (195,306), and a point in Florida. Using the formula above, with lat/long and x/y I calculated a conversion factor of about 14. However, when I did the four corners and the Lake Michigan. The conversion factors varied dramitcally. I thusly assume the the lines curve, even on a flat projection where Texas looks like its near Florida? My code went thus...
If this is the problem I think it is, could someone link me to some trig help? Thanks alot.
Assuming x,y and lat/long are superimposed yet different coordinate systems. For example, if a coordinate system with a unary equivalent to 12 on the other were to exist, express two concurrent points. Then use the distance formula:
sqrt( (24+12)^2+(24+12)^2)/sqrt ( (2+1)^2+(2+1)) = 12 (as do all other concurrent values.)
I found pixel where the four corners states meet (195,306), and a point in Florida. Using the formula above, with lat/long and x/y I calculated a conversion factor of about 14. However, when I did the four corners and the Lake Michigan. The conversion factors varied dramitcally. I thusly assume the the lines curve, even on a flat projection where Texas looks like its near Florida? My code went thus...
Code:
const float refcoord[2]={36.998976, -109.045172};
const float conversionfactor=0.17975951;
const int refpix[2]={195,306};
void drawID(float lat, float lon, FXint& x,FXint& y){
x=refpix[0]-(refcoord[0]-lat)/conversionfactor;
y=refpix[1]-(refcoord[1]-lon)/conversionfactor;
}
If this is the problem I think it is, could someone link me to some trig help? Thanks alot.