From 7efee52485394d97555745e9c041975f3467f85b Mon Sep 17 00:00:00 2001 From: curt Date: Sun, 18 Oct 1998 01:17:16 +0000 Subject: [PATCH] Point3D tweaks. --- Airports/genapt.cxx | 39 +++++++-------------------------------- Main/fg_init.cxx | 5 ++++- Main/views.cxx | 10 ++++++---- Objects/fragment.cxx | 9 ++++++--- Objects/obj.cxx | 23 ++++++++++++++--------- Scenery/tilemgr.cxx | 5 ++++- Time/sunpos.cxx | 5 ++++- 7 files changed, 45 insertions(+), 51 deletions(-) diff --git a/Airports/genapt.cxx b/Airports/genapt.cxx index 4d62bcf23..3ed91daff 100644 --- a/Airports/genapt.cxx +++ b/Airports/genapt.cxx @@ -64,40 +64,12 @@ static double calc_dist(const Point3D& p1, const Point3D& p2) { #define FG_APT_BASE_TEX_CONSTANT 2000.0 -#ifdef OLD_TEX_COORDS -// Calculate texture coordinates for a given point. -static fgPoint3d -calc_tex_coords(const fgPoint3d& p) { - fgPoint3d tex; - - cout << "Texture coordinates = " << - FG_APT_BASE_TEX_CONSTANT * p.lon << " " << - FG_APT_BASE_TEX_CONSTANT * p.lat << "\n"; - - tex.x = fmod(FG_APT_BASE_TEX_CONSTANT * p.lon, 10.0); - tex.y = fmod(FG_APT_BASE_TEX_CONSTANT * p.lat, 10.0); - - if ( tex.x < 0.0 ) { - tex.x += 10.0; - } - - if ( tex.y < 0.0 ) { - tex.y += 10.0; - } - - cout << "Texture coordinates = " << tex.x << " " << tex.y << "\n"; - - return tex; -} -#endif - - // Calculate texture coordinates for a given point. static Point3D calc_tex_coords(double *node, const Point3D& ref) { Point3D cp; Point3D pp; - cp.setvals( node[0] + ref.x(), node[1] + ref.y(), node[2] + ref.z() ); + cp = Point3D( node[0] + ref.x(), node[1] + ref.y(), node[2] + ref.z() ); pp = fgCartToPolar3d(cp); @@ -310,9 +282,9 @@ fgAptGenerate(const string& path, fgTILE *tile) // we have just finished reading and airport record. // process the info size = perimeter.size(); - average.setvals( avex / (double)size + tile->center.x(), - avey / (double)size + tile->center.y(), - avez / (double)size + tile->center.z() ); + average = Point3D( avex / (double)size + tile->center.x(), + avey / (double)size + tile->center.y(), + avez / (double)size + tile->center.z() ); gen_base(average, perimeter, tile); } @@ -322,6 +294,9 @@ fgAptGenerate(const string& path, fgTILE *tile) // $Log$ +// Revision 1.6 1998/10/18 01:17:16 curt +// Point3D tweaks. +// // Revision 1.5 1998/10/16 23:27:14 curt // C++-ifying. // diff --git a/Main/fg_init.cxx b/Main/fg_init.cxx index 8d3bd7303..9ef8d8154 100644 --- a/Main/fg_init.cxx +++ b/Main/fg_init.cxx @@ -199,7 +199,7 @@ int fgInitSubsystems( void ) // the center of the earth and our view position. Doesn't have to // be the exact elevation (this is good because we don't know it // yet :-) - geod_pos.setvals( FG_Longitude, FG_Latitude, 0.0); + geod_pos = Point3D( FG_Longitude, FG_Latitude, 0.0); abs_view_pos = fgGeodToCart(geod_pos); // Calculate ground elevation at starting point @@ -362,6 +362,9 @@ int fgInitSubsystems( void ) // $Log$ +// Revision 1.44 1998/10/18 01:17:17 curt +// Point3D tweaks. +// // Revision 1.43 1998/10/17 01:34:22 curt // C++ ifying ... // diff --git a/Main/views.cxx b/Main/views.cxx index b806fdc69..db33feb76 100644 --- a/Main/views.cxx +++ b/Main/views.cxx @@ -268,10 +268,9 @@ void fgVIEW::UpdateViewMath( fgFLIGHT *f ) { // scenery.center.y, scenery.center.z); // calculate the cartesion coords of the current lat/lon/0 elev - p.setvals( - FG_Longitude, - FG_Lat_geocentric, - FG_Sea_level_radius * FEET_TO_METER ); + p = Point3D( FG_Longitude, + FG_Lat_geocentric, + FG_Sea_level_radius * FEET_TO_METER ); cur_zero_elev = fgPolarToCart3d(p) - scenery.center; @@ -585,6 +584,9 @@ fgVIEW::~fgVIEW( void ) { // $Log$ +// Revision 1.24 1998/10/18 01:17:19 curt +// Point3D tweaks. +// // Revision 1.23 1998/10/17 01:34:26 curt // C++ ifying ... // diff --git a/Objects/fragment.cxx b/Objects/fragment.cxx index aff61494b..2466dfd76 100644 --- a/Objects/fragment.cxx +++ b/Objects/fragment.cxx @@ -202,7 +202,7 @@ int fgFRAGMENT::intersect( const Point3D& end0, // everything is too close together to tell the difference // so the current intersection point should work as good // as any - result.setvals(x, y, z); + result = Point3D(x, y, z); return(1); } side1 = FG_SIGN (t1 - t2); @@ -282,7 +282,7 @@ int fgFRAGMENT::intersect( const Point3D& end0, } else { // all dimensions are really small so lets call it close // enough and return a successful match - result.setvals(x, y, z); + result = Point3D(x, y, z); return(1); } @@ -314,7 +314,7 @@ int fgFRAGMENT::intersect( const Point3D& end0, } // printf( "intersection point = %.2f %.2f %.2f\n", x, y, z); - result.setvals(x, y, z); + result = Point3D(x, y, z); return(1); } @@ -324,6 +324,9 @@ int fgFRAGMENT::intersect( const Point3D& end0, } // $Log$ +// Revision 1.6 1998/10/18 01:17:20 curt +// Point3D tweaks. +// // Revision 1.5 1998/10/16 00:54:37 curt // Converted to Point3D class. // diff --git a/Objects/obj.cxx b/Objects/obj.cxx index 2f997f9ce..7818a8c07 100644 --- a/Objects/obj.cxx +++ b/Objects/obj.cxx @@ -85,29 +85,31 @@ static void calc_normal(double p1[3], double p2[3], } -#define FG_TEX_CONSTANT 128.0 +#define FG_TEX_CONSTANT 8.0 // Calculate texture coordinates for a given point. -Point3D calc_tex_coords(double *node, const Point3D& ref) { +static Point3D calc_tex_coords(double *node, const Point3D& ref) { Point3D cp; Point3D pp; - cp.setvals( node[0] + ref.x(), - node[1] + ref.y(), - node[2] + ref.z() ); + cp = Point3D( node[0] + ref.x(), + node[1] + ref.y(), + node[2] + ref.z() ); pp = fgCartToPolar3d(cp); - pp.setx( fmod(RAD_TO_DEG * FG_TEX_CONSTANT * pp.x(), 25.0) ); - pp.sety( fmod(RAD_TO_DEG * FG_TEX_CONSTANT * pp.y(), 25.0) ); + cout << pp << endl; + + pp.setx( fmod(RAD_TO_DEG * FG_TEX_CONSTANT * pp.x(), 1.0) ); + pp.sety( fmod(RAD_TO_DEG * FG_TEX_CONSTANT * pp.y(), 1.0) ); if ( pp.x() < 0.0 ) { - pp.setx( pp.x() + 25.0 ); + pp.setx( pp.x() + 1.0 ); } if ( pp.y() < 0.0 ) { - pp.sety( pp.y() + 25.0 ); + pp.sety( pp.y() + 1.0 ); } return(pp); @@ -547,6 +549,9 @@ int fgObjLoad( const string& path, fgTILE *t) { // $Log$ +// Revision 1.6 1998/10/18 01:17:21 curt +// Point3D tweaks. +// // Revision 1.5 1998/10/16 00:54:39 curt // Converted to Point3D class. // diff --git a/Scenery/tilemgr.cxx b/Scenery/tilemgr.cxx index 09e81d18f..a52695abb 100644 --- a/Scenery/tilemgr.cxx +++ b/Scenery/tilemgr.cxx @@ -434,7 +434,7 @@ double fgTileMgrCurElev( double lon, double lat, const Point3D& abs_view_pos ) { scenery.next_center = t->center; - earth_center.setvals(0.0, 0.0, 0.0); + earth_center = Point3D(0.0, 0.0, 0.0); fgPrintf( FG_TERRAIN, FG_DEBUG, "Pos = (%.2f, %.2f) Current bucket = %d %d %d %d Index = %ld\n", @@ -633,6 +633,9 @@ void fgTileMgrRender( void ) { // $Log$ +// Revision 1.41 1998/10/18 01:17:23 curt +// Point3D tweaks. +// // Revision 1.40 1998/10/17 01:34:28 curt // C++ ifying ... // diff --git a/Time/sunpos.cxx b/Time/sunpos.cxx index cf0b54eef..37c47aab7 100644 --- a/Time/sunpos.cxx +++ b/Time/sunpos.cxx @@ -346,7 +346,7 @@ void fgUpdateSunPos( void ) { fgGeodToGeoc(sun_gd_lat, 0.0, &sl_radius, &l->sun_gc_lat); - p.setvals( l->sun_lon, l->sun_gc_lat, sl_radius ); + p = Point3D( l->sun_lon, l->sun_gc_lat, sl_radius ); l->fg_sunpos = fgPolarToCart3d(p); printf( " t->cur_time = %ld\n", t->cur_time); @@ -423,6 +423,9 @@ void fgUpdateSunPos( void ) { // $Log$ +// Revision 1.15 1998/10/18 01:17:24 curt +// Point3D tweaks. +// // Revision 1.14 1998/10/17 01:34:32 curt // C++ ifying ... // -- 2.39.5