home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snipps97.zip / TRIGLIB.H < prev    next >
C/C++ Source or Header  |  1997-07-04  |  6KB  |  115 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /******************************************************/
  4. /* Filespec  :  triglib.c triglib.h                   */
  5. /* Date      :  February 21 1997                      */
  6. /* Time      :  14:11                                 */
  7. /* Revision  :  1.0C                                  */
  8. /* Update    :                                        */
  9. /******************************************************/
  10. /* Programmer:  Nigel Traves                          */
  11. /* Address   :  5 Breamer Road, Collingham, Newark,   */
  12. /*           :  Notts, U.K.                           */
  13. /* Post Code :  NG23 7PN                              */
  14. /******************************************************/
  15. /* Released to the Public Domain                      */
  16. /******************************************************/
  17.  
  18. #ifndef TRIGLIB_H
  19. #define TRIGLIB_H
  20.  
  21. /********************************************************************/
  22. /* This library is concerned entirely with angles in general and    */
  23. /* trigonometric functions in particular.                           */
  24. /********************************************************************/
  25.  
  26. enum angle_type {RAD, DEG, GRAD};
  27.  
  28. /********************************************************************/
  29. /* The following three routines 'normalize' the supplied angle to   */
  30. /* be within limits appropiate for the trigonemetric routines.      */
  31. /* normalize_radians ensures that the supplied angle is between -PI */
  32. /* and +PI, normalize_degrees between -180.0 and +180.0 and         */
  33. /* normalize_grade between -200.0 and +200.0.  NOTE - ALL the       */
  34. /* normal trigonometric functions normalize the angle before use,   */
  35. /* and the inverse functions after.                                 */
  36. /********************************************************************/
  37.  
  38. void normalize_radians(double *radians);
  39. void normalize_degrees(double *degrees);
  40. void normalize_grade(double *grade);
  41.  
  42. /********************************************************************/
  43. /* These six routines enable conversion, of angles, between         */
  44. /* radians, degrees and grade.  NOTE there is no need to normalize  */
  45. /* the angle to be converted before calling any of these routines   */
  46. /* as they all call the appropriate normalisation routine.          */
  47. /********************************************************************/
  48.  
  49. double radians_to_degrees(double radians);
  50. double radians_to_grade(double radians);
  51. double degrees_to_radians(double degrees);
  52. double degrees_to_grade(double degrees);
  53. double grade_to_radians(double grade);
  54. double grade_to_degrees(double grade);
  55.  
  56. /********************************************************************/
  57. /* The following six routines are the normal trigonometric          */
  58. /* functions.                                                       */
  59. /********************************************************************/
  60.  
  61. double sine(double angle, enum angle_type atype);
  62. double cosine(double angle, enum angle_type atype);
  63. double tangent(double angle, enum angle_type atype);
  64. double secant(double angle, enum angle_type atype);
  65. double cosecant(double angle, enum angle_type atype);
  66. double cotangent(double angle, enum angle_type atype);
  67.  
  68. /********************************************************************/
  69. /* The following six routines are the normal inverse trigonometric  */
  70. /* functions.                                                       */
  71. /********************************************************************/
  72.  
  73. double arc_sine(double x, enum angle_type outtype);
  74. double arc_cosine(double x, enum angle_type outtype);
  75. double arc_tangent(double x, enum angle_type outtype);
  76. double arc_secant(double x, enum angle_type outtype);
  77. double arc_cosecant(double x, enum angle_type outtype);
  78. double arc_cotangent(double x, enum angle_type outtype);
  79.  
  80. /********************************************************************/
  81. /* The following six routines are the hyperbolic trigonometric      */
  82. /* functions.                                                       */
  83. /********************************************************************/
  84.  
  85. double hyperbolic_sine(double angle, enum angle_type atype);
  86. double hyperbolic_cosine(double angle, enum angle_type atype);
  87. double hyperbolic_tangent(double angle, enum angle_type atype);
  88. double hyperbolic_secant(double angle, enum angle_type atype);
  89. double hyperbolic_cosecant(double angle, enum angle_type atype);
  90. double hyperbolic_cotangent(double angle, enum angle_type atype);
  91.  
  92. /********************************************************************/
  93. /* The following six routines are the hyperbolic inverse            */
  94. /* trigonometric functions.                                         */
  95. /********************************************************************/
  96.  
  97. double hyperbolic_arc_sine(double x, enum angle_type outtype);
  98. double hyperbolic_arc_cosine(double x, enum angle_type outtype);
  99. double hyperbolic_arc_tangent(double x, enum angle_type outtype);
  100. double hyperbolic_arc_secant(double x, enum angle_type outtype);
  101. double hyperbolic_arc_cosecant(double x, enum angle_type outtype);
  102. double hyperbolic_arc_cotangent(double x, enum angle_type outtype);
  103.  
  104. /********************************************************************/
  105. /* The following four routines "complete" the standard library      */
  106. /* functions.                                                       */
  107. /********************************************************************/
  108.  
  109. double sech(double x);
  110. double csch(double x);
  111. double coth(double x);
  112. double acoth(double x);
  113.  
  114. #endif
  115.