This is geometry.h in view mode; [Download] [Up]
/**************************************************************** * * * I C A O M a p - * * * * A n A v i a t i o n U t i l i t y * * * * * * Copyright (C) 1993, 1994 Martin Pauly * * * * N e x t V e r s i o n * * * * Copyright (C) 1994 Stefan Leuker & Oliver Meyer * * * * This file may be freely distributed only if it includes * * the above copyright notice. * * * ****************************************************************/ #import "IcaoDefinitions.h" #import "mapdraw.h" #import <stdlib.h> #import <math.h> #import <stdio.h> #ifndef GEODETIC #define GEODETIC 1 typedef struct { int x; int y; } POINT; typedef struct { POINT p1; POINT p2; } LINE; extern double unitChange[]; extern char *unitName[]; #define UNIT_CHANGE(a) (unitChange[atoi(NXGetDefaultValue(APPNAME, a))]) #define UNIT_NAME(a) (unitName[atoi(NXGetDefaultValue(APPNAME, a))]) int ccw (POINT p0, POINT p1, POINT p2); int intersect (LINE l1, LINE l2); int ppcontains (POINT t, POINT *p, int numpoints); /* calculate the distance between two locations, output in NM */ double distance (LOCATION a, LOCATION b); double distance2 (LOCATION a, LOCATION b); /* calculate the mean true track of the shortest connection between two locations. output in degrees, 0=North, 90=East etc. */ double truetrack (LOCATION a, LOCATION b); double truetrack1 (LOCATION a, LOCATION b); /* convert either a longitude of a latitude into a value that is suitable for the LOCATION struct. input: 99.99'99"X (character string) where 9 is any digit and X is one of N, S, E, W */ long deg2num (char *string); /* convert degrees into radians */ double rad(double deg); /* convert radians into degrees */ double deg(double rad); /* convert internal repr. into radians */ double internal2rad(long internal); /* convert internal to human readable string */ char *internal2string (LOCATION pos); /* convert radians into internal rep. */ long rad2internal (double rad); /* convert map position (in cm) to human readable coordinate pair */ char *cm2string (double mapx, double mapy); /* convert position x,y (in cm) to internal format */ LOCATION cm2internal (double mapx, double mapy); /* convert internal format to map position in cm */ void internal2cm (LOCATION position, double *mapx, double *mapy); /* drawing to the map, it may be necessary to find out what offset has to added to a true track at a given position to properly draw that angle on the map (shifts by zeromeridian etc.): */ int truenorthoffset (LOCATION pos); double proj_x (double latitude, double longitude); double proj_y (double latitude, double longitude); void plane2sphere (double x, double y, double *latitude, double *longitude); #endif
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.