Calculate the phase of the moon. More...
#include <moon.h>
Public Member Functions | |
Moon () | |
~Moon () | |
Static Public Member Functions | |
static double | phase (int mon, int day, int year) |
static void | nextphase (int &mon, int &day, int &year, int &hr, int &min, int nph) |
static double | flmoon (int n, int nph, long &jd, double &frac) |
static void | Julian2Calendar (long jd, int &mon, int &day, int &year) |
static long | Calendar2Julian (int mon, int day, int year) |
static bool | isDST (long jd) |
static bool | isDST (int mon, int day, int year) |
Static Private Attributes | |
static const double | RAD = (3.1415926535897/180.0) |
Radians to degree convertion. | |
static const long | IGREG = (15+31L*(10+12L*1582)) |
static const double | MEAN_LUNAR_CYCLE = 29.53058868 |
Calculate the phase of the moon.
Created March 31, 2004 by Don Dugger
THE SOFTWARE IS PROVIDED ~AS IS~, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Classes
This class is an all static.
This group of metthods deals with the phases of the moon, it also computes
Julian dates, due to the fact it was needed for the moon calculations. To make it
simpler to work with the Julian calculation there left in rather than creating a
separate class.
Some functions are taken from "Numerical Recipes in C - The Art of Scientific Computing" Second Edition, tranlated with changes for C++ and help clarify the code.
ISBN 0-521-43108-5
(Copyright © Cambridge University Press 1988, 1992)
The program definds the phase of the moon as ia floating point number between 0 and 4. The following values apply:
|
static |
Calendar2Julian() computes the date given a julian date
mon | The month. |
day | The day of the month. |
year | The year. |
Definition at line 235 of file moon.c++.
References IGREG.
Referenced by nextphase(), and phase().
|
static |
flmoon() calculates the julian date of nth lunar cycle and nph phase of the moon since Jan 1900 n is the number of lunar cycle since Jan 1900 - ??? This is the original function from the book. It's been modified to work in C++. I also rewrote it to be litte clearer. And added comments where I unterstood what was going on and increased the accuracy of a few constants.
n | The number of lunar cycles. |
nph | The lunar phase. |
jd | The Julian date number. |
frac | The tractional part of the Julian date number. |
Definition at line 162 of file moon.c++.
References RAD.
Referenced by nextphase(), and phase().
|
static |
|
static |
isDST() returns true if the given date is day light savings time There are two versions, one which takes the Julian date and one that takes the monuth, day and year.
jd | The Julian date |
Definition at line 258 of file moon.c++.
References isDST(), and Julian2Calendar().
Referenced by isDST(), and nextphase().
|
static |
Julian2Calendar() computes the julian date
jd | The Julian date number. |
mon | The month. |
day | The day of the month. |
year | The year. |
Definition at line 205 of file moon.c++.
Referenced by isDST(), and nextphase().
|
static |
nextphase() calculates the date & time of next phase of the moon, that is the next hole number, given the start date.
mon | The month. |
day | The day of the month. |
year | The year. |
hr | The hour. |
min | The minute. |
nph | The Lunar Phase See above Lunar Phases |
Definition at line 120 of file moon.c++.
References Calendar2Julian(), flmoon(), isDST(), and Julian2Calendar().
|
static |
phase() calculates the phase of the moon at noon of the date given. p> See above Lunar Phases
mon | The month. |
day | The day of the month. |
year | The year. |
Definition at line 30 of file moon.c++.
References Calendar2Julian(), flmoon(), and MEAN_LUNAR_CYCLE.
|
staticprivate |
We will call this the Gregorian Interval. The Gregorian Calendar was adopted in October 15, 1582.
Definition at line 73 of file moon.h.
Referenced by Calendar2Julian().
|
staticprivate |
|
staticprivate |
Radians to degree convertion.
moon.c++
Created March 31, 2004 by Don Dugger
THE SOFTWARE IS PROVIDED ~AS IS~, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Definition at line 70 of file moon.h.
Referenced by flmoon().