~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to incl/trigo.h

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* @(#)trigo.h  19.1 (ESO-IPG) 02/25/03 13:49:44 */
 
2
/*+++++++++
 
3
.Header         trigo.h
 
4
.LANGUAGE       C
 
5
.AUTHOR         Francois Ochsenbein [ESO-IPG]
 
6
.KEYWORDS       Trigonometric mathematical functions
 
7
.COMMENTS       This header contains declarations for mathematical functions 
 
8
                and macros for spherical/hyperbolic transformations.
 
9
 
 
10
.VERSION 1.0    21-Oct-1985: Creation
 
11
.VERSION 1.1    05-Dec-1988: Transformed some macros to functions
 
12
----------------*/
 
13
 
 
14
#ifndef  TRIGO_DEF
 
15
#define  TRIGO_DEF      0
 
16
 
 
17
#include <math.h>       /* Use system Math Library */
 
18
#include <compiler.h>   /* If function templates are allowed */
 
19
 
 
20
                        /* CG 930916: PI is defined in math.h(Linux) */
 
21
#ifndef PI              
 
22
#define PI      3.14159265358979325e0
 
23
#endif
 
24
 
 
25
#define DEG     (180.e0/PI)                     /* radians to degrees   */
 
26
                        /* =57.295779513082320e0                        */
 
27
 
 
28
/*=========================================================================
 
29
                1. Trigonometric functions
 
30
 *=========================================================================*/
 
31
 
 
32
/* Standard:    sin(x) cos(x) tan(x) sinh(x) cosh(x) tanh(x)    */
 
33
 
 
34
        /* Argument in degrees: */
 
35
 
 
36
#if _TEMPLATES_
 
37
 
 
38
double cosd (double x); 
 
39
double sind (double x); 
 
40
double tand (double x); 
 
41
double acosd(double x);
 
42
double asind(double x);
 
43
double atand(double x);
 
44
double atan2d(double x, double y);    
 
45
#else
 
46
double acosd(), asind(), atand(), atan2d(); 
 
47
double cosd(), sind(), tand();
 
48
#endif
 
49
 
 
50
/*=========================================================================
 
51
                2. Spherical functions
 
52
 *=========================================================================*/
 
53
 
 
54
#if _TEMPLATES_
 
55
int     tr_ou   (double o[2] , double u[3]);
 
56
int     tr_uo   (double u[3] , double o[2]);
 
57
        /* Surface of a `rectangle' on the sphere */
 
58
double  surf_o  (double o1[2], double o2[2]);           /* Pos. in degrees */
 
59
double  surf_p  (double p1[2], double p2[2]);           /* On gnomonic proj. */
 
60
        /* Distances between two points on the sphere (degrees) */
 
61
double  s2d_u   (double u1[3], double u2[3]);
 
62
double  s2d_o   (double o1[2], double o2[2]);
 
63
double  s2d_p   (double p1[2], double p2[2]);
 
64
double  dist_u  (double u1[3], double u2[3]);
 
65
double  dist_o  (double o1[2], double o2[2]);
 
66
double  dist_p  (double p1[2], double p2[2]);
 
67
#else
 
68
double  surf_o(), surf_p();
 
69
double  s2d_o(),   s2d_p(),   s2d_u();
 
70
double  dist_o(),  dist_p(), dist_u();
 
71
#endif
 
72
 
 
73
/*=========================================================================
 
74
                3. Other standard Math Functions
 
75
 *=========================================================================*/
 
76
 
 
77
/* Standard: atof(x) log(x) log10(x) exp(x) sqrt(x)     */
 
78
/* Standard: hypoth(x,y)= sqrt(x*x + y*y)       */
 
79
/* Standard: pow(x,y)   = x**y                  */
 
80
 
 
81
#if _TEMPLATES_
 
82
double sinc (double x);         /* sin(x)/x */
 
83
double asinc(double x);         /* asin(x)/x */
 
84
double acosh(double x);
 
85
double asinh(double x);
 
86
double atanh(double x);
 
87
#else
 
88
double sinc(), asinc();
 
89
double acosh(), asinh(), atanh();
 
90
#endif
 
91
 
 
92
 
 
93
 
 
94
/*=========================================================================
 
95
                4. Arithmetic operations
 
96
 *=========================================================================*/
 
97
 
 
98
/* Standard: ceil(x) floor(x) fabs(x)   */
 
99
/* Standard: fmod(x,y) = x%y, with same sign as x */
 
100
 
 
101
                                        /* trigo functions in degrees*/
 
102
/*=========================================================================
 
103
                5. Mantissa / Exponent Conversions
 
104
 *=========================================================================*/
 
105
 
 
106
/* Standard: m = frexp (x, &e)  Returns m and e such that x = m * 2**e  
 
107
                                        with |m| in range [0.5, 1[      */
 
108
/* Standard: y = ldexp (m,  e)  Returns y = m * 2**e                    */
 
109
/* Standard: f = modf  (x, &E)  Returns f and E (double) with x = E + f
 
110
                                        f = fractional part with same
 
111
                                                sign as x               */
 
112
                                                
 
113
#endif