1
0
Fork 0

Updated polartocart conversion routine.

This commit is contained in:
curt 1998-05-02 01:51:01 +00:00
parent de51293e5c
commit 1f5aeb1d46
2 changed files with 25 additions and 11 deletions

View file

@ -32,7 +32,7 @@
#include <Flight/flight.h> #include <Flight/flight.h>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Math/mat3.h> #include <Math/mat3.h>
#include <Math/polar.h> #include <Math/polar3d.h>
#include <Math/vector.h> #include <Math/vector.h>
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
#include <Time/fg_time.hxx> #include <Time/fg_time.hxx>
@ -55,6 +55,7 @@ void fgViewInit(fgVIEW *v) {
// Update the view parameters // Update the view parameters
void fgViewUpdate(fgFLIGHT *f, fgVIEW *v, fgLIGHT *l) { void fgViewUpdate(fgFLIGHT *f, fgVIEW *v, fgLIGHT *l) {
fgPolarPoint3d p;
MAT3vec vec, forward, v0, minus_z; MAT3vec vec, forward, v0, minus_z;
MAT3mat R, TMP, UP, LOCAL, VIEW; MAT3mat R, TMP, UP, LOCAL, VIEW;
double ntmp; double ntmp;
@ -64,15 +65,22 @@ void fgViewUpdate(fgFLIGHT *f, fgVIEW *v, fgLIGHT *l) {
scenery.center.z = scenery.next_center.z; scenery.center.z = scenery.next_center.z;
// calculate the cartesion coords of the current lat/lon/0 elev // calculate the cartesion coords of the current lat/lon/0 elev
v->cur_zero_elev = fgPolarToCart(FG_Longitude, FG_Lat_geocentric, p.lon = FG_Longitude;
FG_Sea_level_radius * FEET_TO_METER); p.lat = FG_Lat_geocentric;
p.radius = FG_Sea_level_radius * FEET_TO_METER;
v->cur_zero_elev = fgPolarToCart3d(p);
v->cur_zero_elev.x -= scenery.center.x; v->cur_zero_elev.x -= scenery.center.x;
v->cur_zero_elev.y -= scenery.center.y; v->cur_zero_elev.y -= scenery.center.y;
v->cur_zero_elev.z -= scenery.center.z; v->cur_zero_elev.z -= scenery.center.z;
// calculate view position in current FG view coordinate system // calculate view position in current FG view coordinate system
v->abs_view_pos = fgPolarToCart(FG_Longitude, FG_Lat_geocentric, // p.lon & p.lat are already defined earlier
FG_Radius_to_vehicle * FEET_TO_METER + 1.0); p.radius = FG_Radius_to_vehicle * FEET_TO_METER + 1.0;
v->abs_view_pos = fgPolarToCart3d(p);
v->view_pos.x = v->abs_view_pos.x - scenery.center.x; v->view_pos.x = v->abs_view_pos.x - scenery.center.x;
v->view_pos.y = v->abs_view_pos.y - scenery.center.y; v->view_pos.y = v->abs_view_pos.y - scenery.center.y;
v->view_pos.z = v->abs_view_pos.z - scenery.center.z; v->view_pos.z = v->abs_view_pos.z - scenery.center.z;
@ -200,6 +208,9 @@ void fgViewUpdate(fgFLIGHT *f, fgVIEW *v, fgLIGHT *l) {
// $Log$ // $Log$
// Revision 1.8 1998/05/02 01:51:01 curt
// Updated polartocart conversion routine.
//
// Revision 1.7 1998/04/30 12:34:20 curt // Revision 1.7 1998/04/30 12:34:20 curt
// Added command line rendering options: // Added command line rendering options:
// enable/disable fog/haze // enable/disable fog/haze

View file

@ -43,14 +43,14 @@
/* Define a structure containing view information */ /* Define a structure containing view information */
typedef struct { typedef struct {
/* absolute view position */ /* absolute view position */
struct fgCartesianPoint abs_view_pos; fgCartesianPoint3d abs_view_pos;
/* view position translated to scenery.center */ /* view position translated to scenery.center */
struct fgCartesianPoint view_pos; fgCartesianPoint3d view_pos;
/* cartesion coordinates of current lon/lat if at sea level /* cartesion coordinates of current lon/lat if at sea level
* translated to scenery.center*/ * translated to scenery.center*/
struct fgCartesianPoint cur_zero_elev; fgCartesianPoint3d cur_zero_elev;
/* vector in cartesian coordinates from current position to the /* vector in cartesian coordinates from current position to the
* postion on the earth's surface the sun is directly over */ * postion on the earth's surface the sun is directly over */
@ -98,10 +98,13 @@ void fgViewUpdate(fgFLIGHT *f, fgVIEW *v, fgLIGHT *l);
/* $Log$ /* $Log$
/* Revision 1.4 1998/04/28 01:20:24 curt /* Revision 1.5 1998/05/02 01:51:02 curt
/* Type-ified fgTIME and fgVIEW. /* Updated polartocart conversion routine.
/* Added a command line option to disable textures.
/* /*
* Revision 1.4 1998/04/28 01:20:24 curt
* Type-ified fgTIME and fgVIEW.
* Added a command line option to disable textures.
*
* Revision 1.3 1998/04/25 22:06:31 curt * Revision 1.3 1998/04/25 22:06:31 curt
* Edited cvs log messages in source files ... bad bad bad! * Edited cvs log messages in source files ... bad bad bad!
* *