Wrp File Format - 4WVR – Talk
mNo edit summary |
mNo edit summary |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 14: | Line 14: | ||
Ok, when I want to convert them back I am using something like this: | Ok, when I want to convert them back I am using something like this: | ||
f_e = floor( w_e / 22222.0f ) * 1000 | f_e = floor( w_e / 22222.0f ) * 1000 + | ||
floor( (w_e mod 22222.0f) / 2222.2f ) * 100 | floor( (w_e mod 22222.0f) / 2222.2f ) * 100 + | ||
floor( (w_e mod 2222.2f) / 222.22f ) * 10 | floor( (w_e mod 2222.2f) / 222.22f ) * 10 + a.s.o. | ||
--[[User:Mikero|ook?]] 13:50, 13 July 2006 (CEST) | --[[User:Mikero|ook?]] 13:50, 13 July 2006 (CEST) | ||
This value is an integral of the gridsize. | |||
the gridsize is a fixed 50 metre CUBE. (This is applied equally to XY and Z) | |||
GridDimension= Elevation/50.0 | |||
Bis Floats are accurate to 4 decimal places | |||
1.9999 eg | |||
hence the actual value stored only needs the integer and those 4 digits | |||
GridDimension= (short)floor( (Elevation/50)*1000); | |||
ie the 4 important digits are elevated to the integer position of a float. a floor is applied to get ONLY the integer component, and, finally, this is converted (stored) as a genuine short (signed) integer. | |||
The max height or depth of an elevaton is +/- 1.6km |
Latest revision as of 16:59, 21 November 2009
note to self via vektorbosen
When trying to view the elevations I realized, that the elevations aren't short values as A-Lone-Wolfs doc implies.
After watching some hex-values, I found some formulas, that should reflect the values right.
w_e: elevations as in 4WVR wrp file f_e: elevations with floating point value
When I create some elevations and want them to convert to Wrp-elevations I'm using the following formula:
w_e = (short) ((f_e / 0.05) * 1.1111)
Ok, when I want to convert them back I am using something like this:
f_e = floor( w_e / 22222.0f ) * 1000 +
floor( (w_e mod 22222.0f) / 2222.2f ) * 100 + floor( (w_e mod 2222.2f) / 222.22f ) * 10 + a.s.o.
--ook? 13:50, 13 July 2006 (CEST)
This value is an integral of the gridsize.
the gridsize is a fixed 50 metre CUBE. (This is applied equally to XY and Z)
GridDimension= Elevation/50.0
Bis Floats are accurate to 4 decimal places
1.9999 eg
hence the actual value stored only needs the integer and those 4 digits
GridDimension= (short)floor( (Elevation/50)*1000);
ie the 4 important digits are elevated to the integer position of a float. a floor is applied to get ONLY the integer component, and, finally, this is converted (stored) as a genuine short (signed) integer.
The max height or depth of an elevaton is +/- 1.6km