![]() |
![]() |
![]() |
Grits Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#define EARTH_R #define EARTH_C #define NORTH #define SOUTH #define EAST #define WEST #define azim2lon (azim) #define lon2azim (lon) #define incl2lat (incl) #define lat2incl (lat) #define rad2elev (rad) #define elev2rad (elev) #define deg2rad (deg) #define rad2deg (rad) struct GritsPoint; void grits_point_set_lle (GritsPoint *point
,gdouble lat
,gdouble lon
,gdouble elev
); struct GritsBounds; void grits_bounds_set_bounds (GritsBounds *bounds
,gdouble n
,gdouble s
,gdouble e
,gdouble w
); #define FOV_DIST #define MPPX (dist) void lle2xyz (gdouble lat
,gdouble lon
,gdouble elev
,gdouble *x
,gdouble *y
,gdouble *z
); void xyz2lle (gdouble x
,gdouble y
,gdouble z
,gdouble *lat
,gdouble *lon
,gdouble *elev
); void xyz2ll (gdouble x
,gdouble y
,gdouble z
,gdouble *lat
,gdouble *lon
); gdouble ll2m (gdouble lon_dist
,gdouble lat
); gdouble distd (gdouble *a
,gdouble *b
); gdouble lon_avg (gdouble a
,gdouble b
);
Miscellaneous utility functions, these deal mostly with coordinate conversion. Below are some examples that should help demonstrate how these functions work.
Example 1. Terminology
deg - Degrees rad - Radians, also radius m - Meters, for earth-based distances px - Pixels, for screen-based distances height - Height, the distance above the geoid (ground) elev - Elevation, the distance above the spheroid rad - Radius, the distance from the center of the earth lat - Latitude, amount north-south, -90 (S) .. 90 (N) lon - Longitude, amount east-west, -180 (W) .. 180 (E) incl - Inclination, polar equiv of latitude, Pi .. 0 azim - Azimuth, polar equiv of longitude, -Pi .. Pi x - 0° lon is positive y - 90° lon is positive z - North pole is positive llh - lat,lon,height lle - lat,lon,elev llr - lat,lon,rad pol - incl,azim,rad xyz - x,y,z
Example 2. Conversions
lat lon elev -> x y z lle2xyz: 0.0, 0.0, 0.0 -> 0.0, 0.0, 10.0 lle2xyz: 90.0, 0.0, 0.0 -> 0.0, 10.0, 0.0 lle2xyz: 0.0, 90.0, 0.0 -> 10.0, 0.0, 0.0 x y z -> lat lon elev xyz2lle: 10.0, 0.0, 0.0 -> 0.0, 90.0, 0.0 xyz2lle: 0.0, 10.0, 0.0 -> 90.0, 0.0, 0.0 xyz2lle: 0.0, 0.0, 10.0 -> 0.0, 0.0, 0.0
#define azim2lon(azim) ((azim)*180/G_PI)
Convert azimuth to longitude
|
the azimuth in radians |
Returns : |
the longitude |
#define lon2azim(lon) ((lon)*G_PI/180)
Convert longitude to azimuth
|
the longitude |
Returns : |
the azimuth in radians |
#define incl2lat(incl) (90-(incl)*180/G_PI)
Convert inclination to latitude
|
the inclination in radians |
Returns : |
the latitude |
#define lat2incl(lat) ((90-(lat))*G_PI/180)
Convert latitude to inclination
|
the latitude |
Returns : |
the inclination in radians |
#define rad2elev(rad) ((rad)-EARTH_R)
Convert radius to elevation
|
the radius in meters |
Returns : |
the elevation in meters above the earth surface |
#define elev2rad(elev) ((elev)+EARTH_R)
Convert elevation to radius
|
the elevation in meters above the earth surface |
Returns : |
the radius in meters |
#define deg2rad(deg) (((deg)*G_PI)/180.0)
Convert degrees to radians
|
the angle in degrees |
Returns : |
the angle in radians |
#define rad2deg(rad) (((rad)*180.0)/G_PI)
Convert radians to degrees
|
the angle in radians |
Returns : |
the angle in degrees |
void grits_point_set_lle (GritsPoint *point
,gdouble lat
,gdouble lon
,gdouble elev
);
Set the latitude, longitude, and elevation for a point.
|
the point to modify |
|
the new latitude |
|
the new longitude |
|
the new elevation |
void grits_bounds_set_bounds (GritsBounds *bounds
,gdouble n
,gdouble s
,gdouble e
,gdouble w
);
Set the north, south, east, and west edges of the bounding box
|
the north edge |
|
the south edge |
|
the east edge |
|
the west edge |
#define MPPX(dist) (4*dist/FOV_DIST)
Get the resolution that a point would be drawn at on the screen
|
the distance between the eye and the point in question |
Returns : |
the resolution in meters per pixel |
void lle2xyz (gdouble lat
,gdouble lon
,gdouble elev
,gdouble *x
,gdouble *y
,gdouble *z
);
Convert a point from latitude, longitude, and elevation to x, y and z coordinates.
|
the latitude |
|
the longitude |
|
the elevation |
|
the resulting x coordinate |
|
the resulting y coordinate |
|
the resulting z coordinate |
void xyz2lle (gdouble x
,gdouble y
,gdouble z
,gdouble *lat
,gdouble *lon
,gdouble *elev
);
Convert a point from x, y and z coordinates to latitude, longitude, and elevation.
|
the x coordinate |
|
the y coordinate |
|
the z coordinate |
|
the resulting latitude |
|
the resulting longitude |
|
the resulting elevation |
void xyz2ll (gdouble x
,gdouble y
,gdouble z
,gdouble *lat
,gdouble *lon
);
Get the latitude and longitude for a x, y, z value.
|
the x coordinate |
|
the y coordinate |
|
the z coordinate |
|
the resulting latitude |
|
the resulting longitude |
gdouble ll2m (gdouble lon_dist
,gdouble lat
);
Calculate the distance of longitudinal span at a particular latitude.
|
the distance in degrees of longitude |
|
the latitude to calculate at |
Returns : |
the distance in meters |
gdouble distd (gdouble *a
,gdouble *b
);
Calculate the distance between two three dimensional points.
|
the first point |
|
the second point |
Returns : |
the distance between the points |