Working on redoing internal coordinate systems & scenery transformations.
This commit is contained in:
parent
9c4b4abb50
commit
68af57b759
4 changed files with 34 additions and 17 deletions
|
@ -26,7 +26,8 @@
|
||||||
|
|
||||||
TARGET = libMath.a
|
TARGET = libMath.a
|
||||||
|
|
||||||
CFILES = MAT3geom.c MAT3inv.c MAT3mat.c MAT3vec.c fg_random.c polar.c
|
CFILES = MAT3geom.c MAT3inv.c MAT3mat.c MAT3vec.c fg_geodesy.c fg_random.c \
|
||||||
|
polar.c
|
||||||
OFILES = $(CFILES:.c=.o)
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,6 +69,9 @@ MAT3mat.o:
|
||||||
MAT3vec.o:
|
MAT3vec.o:
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
fg_geodesy.o:
|
||||||
|
$(CC) $(CFLAGS) -c fg_geodesy.c -o $@
|
||||||
|
|
||||||
fg_random.o:
|
fg_random.o:
|
||||||
$(CC) $(CFLAGS) -c fg_random.c -o $@
|
$(CC) $(CFLAGS) -c fg_random.c -o $@
|
||||||
|
|
||||||
|
@ -77,6 +81,9 @@ polar.o:
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# $Log$
|
# $Log$
|
||||||
|
# Revision 1.12 1997/07/31 22:52:27 curt
|
||||||
|
# Working on redoing internal coordinate systems & scenery transformations.
|
||||||
|
#
|
||||||
# Revision 1.11 1997/07/30 16:04:08 curt
|
# Revision 1.11 1997/07/30 16:04:08 curt
|
||||||
# Moved random routines from Utils/ to Math/
|
# Moved random routines from Utils/ to Math/
|
||||||
#
|
#
|
||||||
|
|
|
@ -2,5 +2,7 @@ MAT3geom.o: MAT3geom.c mat3defs.h mat3.h
|
||||||
MAT3inv.o: MAT3inv.c mat3defs.h mat3.h
|
MAT3inv.o: MAT3inv.c mat3defs.h mat3.h
|
||||||
MAT3mat.o: MAT3mat.c mat3defs.h mat3.h
|
MAT3mat.o: MAT3mat.c mat3defs.h mat3.h
|
||||||
MAT3vec.o: MAT3vec.c mat3.h
|
MAT3vec.o: MAT3vec.c mat3.h
|
||||||
|
fg_geodesy.o: fg_geodesy.c fg_geodesy.h ../constants.h
|
||||||
fg_random.o: fg_random.c fg_random.h
|
fg_random.o: fg_random.c fg_random.h
|
||||||
|
geotest.o: geotest.c ../constants.h fg_geodesy.h
|
||||||
polar.o: polar.c polar.h ../types.h ../constants.h
|
polar.o: polar.c polar.h ../types.h ../constants.h
|
||||||
|
|
23
Math/polar.c
23
Math/polar.c
|
@ -35,15 +35,15 @@
|
||||||
static double st, ct, sp, cp;
|
static double st, ct, sp, cp;
|
||||||
|
|
||||||
|
|
||||||
/* Convert a geodetic coordinate to a cartesian coordinat on the unit
|
/* Convert a polar coordinate to a cartesian coordinate. Lon and Lat
|
||||||
* circle, scaled by the radius of the earth in meters. Ignores Altitude,
|
* must be specified in radians. The FG convention is for distances
|
||||||
* since this is just for translating points around on the surface. */
|
* to be specified in meters */
|
||||||
struct fgCartesianPoint fgGeodetic2Cartesian(double lon, double lat) {
|
struct fgCartesianPoint fgPolarToCart(double lon, double lat, double radius) {
|
||||||
struct fgCartesianPoint pnew;
|
struct fgCartesianPoint pnew;
|
||||||
|
|
||||||
pnew.x = cos(lon) * cos(lat) * EARTH_RAD;
|
pnew.x = cos(lon) * cos(lat) * radius;
|
||||||
pnew.y = sin(lon) * cos(lat) * EARTH_RAD;
|
pnew.y = sin(lon) * cos(lat) * radius;
|
||||||
pnew.z = sin(lat) * EARTH_RAD;
|
pnew.z = sin(lat) * radius;
|
||||||
|
|
||||||
return(pnew);
|
return(pnew);
|
||||||
}
|
}
|
||||||
|
@ -101,6 +101,9 @@ struct fgCartesianPoint fgRotateCartesianPoint(struct fgCartesianPoint p) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.1 1997/07/07 21:02:36 curt
|
/* Revision 1.2 1997/07/31 22:52:27 curt
|
||||||
/* Initial revision.
|
/* Working on redoing internal coordinate systems & scenery transformations.
|
||||||
/* */
|
/*
|
||||||
|
* Revision 1.1 1997/07/07 21:02:36 curt
|
||||||
|
* Initial revision.
|
||||||
|
* */
|
||||||
|
|
17
Math/polar.h
17
Math/polar.h
|
@ -31,10 +31,11 @@
|
||||||
#include "../types.h"
|
#include "../types.h"
|
||||||
|
|
||||||
|
|
||||||
/* Convert a geodetic coordinate to a cartesian coordinat on the unit
|
/* Convert a polar coordinate to a cartesian coordinate. Lon and Lat
|
||||||
* circle, scaled by the radius of the earth in meters. Ignores Altitude,
|
* must be specified in radians. The FG convention is for distances
|
||||||
* since this is just for translating points around on the surface. */
|
* to be specified in meters */
|
||||||
struct fgCartesianPoint fgGeodetic2Cartesian(double lon, double lat);
|
struct fgCartesianPoint fgPolarToCart(double lon, double lat, double radius);
|
||||||
|
|
||||||
|
|
||||||
/* Precalculate as much as possible so we can do a batch of transforms
|
/* Precalculate as much as possible so we can do a batch of transforms
|
||||||
* through the same angles, will rotates a cartesian point about the
|
* through the same angles, will rotates a cartesian point about the
|
||||||
|
@ -52,6 +53,7 @@ struct fgCartesianPoint fgGeodetic2Cartesian(double lon, double lat);
|
||||||
*/
|
*/
|
||||||
void fgRotateBatchInit(double Theta, double Phi);
|
void fgRotateBatchInit(double Theta, double Phi);
|
||||||
|
|
||||||
|
|
||||||
/* Rotates a cartesian point about the center of the earth by Theta
|
/* Rotates a cartesian point about the center of the earth by Theta
|
||||||
* (longitude axis) and Phi (latitude axis) */
|
* (longitude axis) and Phi (latitude axis) */
|
||||||
struct fgCartesianPoint fgRotateCartesianPoint(struct fgCartesianPoint p);
|
struct fgCartesianPoint fgRotateCartesianPoint(struct fgCartesianPoint p);
|
||||||
|
@ -61,9 +63,12 @@ struct fgCartesianPoint fgRotateCartesianPoint(struct fgCartesianPoint p);
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.2 1997/07/23 21:52:21 curt
|
/* Revision 1.3 1997/07/31 22:52:28 curt
|
||||||
/* Put comments around the text after an #endif for increased portability.
|
/* Working on redoing internal coordinate systems & scenery transformations.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.2 1997/07/23 21:52:21 curt
|
||||||
|
* Put comments around the text after an #endif for increased portability.
|
||||||
|
*
|
||||||
* Revision 1.1 1997/07/07 21:02:37 curt
|
* Revision 1.1 1997/07/07 21:02:37 curt
|
||||||
* Initial revision.
|
* Initial revision.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue