• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • kstars
  • data
  • tools
angconversion.h
Go to the documentation of this file.
1 /***************************************************************************
2  angconversion.h -- Functions for converting angle formats
3  -------------------
4  begin : Sat Jul 9 2011
5  copyright : (C) 2011 by Akarsh Simha
6  email : akarshsimha@gmail.com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef ANGCONVERSION_H
19 #define ANGCONVERSION_H
20 
21 #include <math.h> /* For M_PI */
22 
23 /* Angle conversion macros */
24 #define RADPERDEG (M_PI/180.0) /* Number of radians in a degree */
25 
26 /* Basic conversions between Degrees, Hours and Radians */
27 inline double deg2rad(double x) { return (x * RADPERDEG); }
28 inline double rad2deg(double x) { return (x / RADPERDEG); }
29 inline double hour2deg(double x) { return (x * 15.0); }
30 inline double deg2hour(double x) { return (x / 15.0); }
31 inline double hour2rad(double x) { return deg2rad( hour2deg(x) ); }
32 inline double rad2hour(double x) { return deg2hour( rad2deg(x) ); }
33 
34 /* Convert degrees to arcminutes or arcseconds and back */
35 inline double deg2arcsec(double x) { return (x * 3600.0); }
36 inline double arcsec2deg(double x) { return (x / 3600.0); }
37 inline double deg2arcmin(double x) { return (x * 60.0); }
38 inline double arcmin2deg(double x) { return (x / 60.0); }
39 
40 /* The following are redundant, but anyway */
41 inline double hour2sec(double x) { return (x * 3600.0); }
42 inline double sec2hour(double x) { return (x / 3600.0); }
43 inline double hour2min(double x) { return (x * 60.0); }
44 inline double min2hour(double x) { return (x / 60.0); }
45 
46 /* Convert DMS / HMS to Degrees / Hours */
47 inline double dms2deg(double d, double m, double s) { return (d + m / 60.0 + s/3600.0); }
48 inline double hms2hour(double h, double m, double s) { return (h + m / 60.0 + s / 3600.0); }
49 
50 void deg2dms(double D, int *d, int *m, float *s) {
51  *d = (int)D;
52  *m = (int)(( D - *d ) * 60);
53  *s = (int)(( D - *d ) * 3600 - (*m * 60));
54 }
55 
56 void hour2hms(double H, int *h, int *m, float *s) { /* Another redundant function */
57  *h = (int)H;
58  *m = (int)(( H - *h ) * 60);
59  *s = (int)(( H - *h ) * 3600 - (*m * 60));
60 }
61 
62 #endif
sec2hour
double sec2hour(double x)
Definition: angconversion.h:42
hms2hour
double hms2hour(double h, double m, double s)
Definition: angconversion.h:48
hour2min
double hour2min(double x)
Definition: angconversion.h:43
arcmin2deg
double arcmin2deg(double x)
Definition: angconversion.h:38
hour2hms
void hour2hms(double H, int *h, int *m, float *s)
Definition: angconversion.h:56
rad2hour
double rad2hour(double x)
Definition: angconversion.h:32
deg2dms
void deg2dms(double D, int *d, int *m, float *s)
Definition: angconversion.h:50
deg2rad
double deg2rad(double x)
Definition: angconversion.h:27
hour2sec
double hour2sec(double x)
Definition: angconversion.h:41
rad2deg
double rad2deg(double x)
Definition: angconversion.h:28
arcsec2deg
double arcsec2deg(double x)
Definition: angconversion.h:36
deg2arcmin
double deg2arcmin(double x)
Definition: angconversion.h:37
hour2rad
double hour2rad(double x)
Definition: angconversion.h:31
hour2deg
double hour2deg(double x)
Definition: angconversion.h:29
min2hour
double min2hour(double x)
Definition: angconversion.h:44
NaN::d
const double d
Definition: nan.h:35
deg2arcsec
double deg2arcsec(double x)
Definition: angconversion.h:35
dms2deg
double dms2deg(double d, double m, double s)
Definition: angconversion.h:47
deg2hour
double deg2hour(double x)
Definition: angconversion.h:30
RADPERDEG
#define RADPERDEG
Definition: angconversion.h:24
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal