Re: obj.read_bin() followed by obj.write_bin() or obj.write_ascii()

"Dale E. Edmons" <[email protected]> Wed, 12 Jan 2005 19:32:47 -0800
Newsgroups gmane.games.flightgear.terragear.devel
Message-ID <[email protected]>
Dale E. Edmons wrote:

> Hi,
>
> I've implemented my SPX conversion stuff in TerraGear/SimGear. 

Found the problem(s):

>
>    for(int i=0; i < (int)wgs84_nodes.size(); i++) {
>        cart = wgs84_nodes[i] + center + Point3D(0.0,0.0,radius);  // 
> radius made things worse

          cart = wgs84_nodes[i] + center;

>        geodr = sgCartToGeod(cart);
>        geod.setx( geodr.x() / SGD_DEGREES_TO_RADIANS);
>        geod.sety( geodr.y() / SGD_DEGREES_TO_RADIANS);
>        geod.setz( geodr.z() / SGD_DEGREES_TO_RADIANS);

          geod.setz( geodr.z() );

>        cout << "converting: " << geod << endl;
>        utm = sgGeodToUTM( geod );   // required!
>        cout << "result = " << utm << "\n" << endl;
>        utm_nodes.push_back( utm );
>    }
>    cout << "converted " << utm_nodes.size() << " nodes to UTM" << endl;
>
Plus, I added easting(), northing() to Point3D.  I also had an x/y set 
to lat/lon but it should be lon/lat.

>
> ------------
>
> Thanks in advance if anybody has suggestions.
>
>
> Dale
>
If anybody is interested in the offset UTM code I'll be glad to make it 
available.  I simply change the ::write_spx() call to ::write_ascii().  
It requires a large change to simgear/math/sg_geodesy.[ch]xx but 
shouldn't affect normal operations.  The UTM code is that sent to me 
from Frederic B. of FGSD.

This code is useful for converting to models that have a x=east, 
y=north, z=altitude with a center of (0,0).
I apply a common offset to every tile by storing the same constant point 
in gbs_center.


Dale

_______________________________________________
Terragear-devel mailing list
[email protected]
http://mail.flightgear.org/mailman/listinfo/terragear-devel
2f585eeea02e2c79d7b1d8c4963bae2d