[Python-ogre-commit] SF.net SVN: python-ogre:[681] trunk/python-ogre
Brought to you by:
andy_miller,
roman_yakovenko
From: <and...@us...> - 2008-08-01 03:24:30
|
Revision: 681 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=681&view=rev Author: andy_miller Date: 2008-08-01 03:24:34 +0000 (Fri, 01 Aug 2008) Log Message: ----------- Implemented a CTYPE scheme (thanks to Romans Py++) for exposing void *'s Upgraded ogreforests to R2483 and cadelum to R264 Support for ODE 0.10.1 Modified Paths: -------------- trunk/python-ogre/PythonOgreConfig_nt.py trunk/python-ogre/PythonOgreConfig_posix.py trunk/python-ogre/code_generators/caelum/generate_code.py trunk/python-ogre/code_generators/caelum/python_caelum.h trunk/python-ogre/code_generators/common_utils/__init__.py trunk/python-ogre/code_generators/ode/generate_code.py trunk/python-ogre/code_generators/ogreforests/customization_data.py trunk/python-ogre/code_generators/ogreforests/generate_code.py trunk/python-ogre/code_generators/ogreforests/hand_made_wrappers.py trunk/python-ogre/code_generators/ogreforests/python_forests.h trunk/python-ogre/code_generators/ogreforests/python_forests_aliases.h trunk/python-ogre/code_generators/ogreforests/python_forests_sizeof.h trunk/python-ogre/code_generators/physx/generate_code.py trunk/python-ogre/demos/caelum/Demo_Caelum01.py trunk/python-ogre/environment.py trunk/python-ogre/scripts/compilesource.bat Added Paths: ----------- trunk/python-ogre/ThirdParty/caelum/Astronomy.cpp trunk/python-ogre/ThirdParty/caelum/Astronomy.h trunk/python-ogre/ThirdParty/caelum/BrightStarCatalogue.cpp trunk/python-ogre/ThirdParty/caelum/Caelum.h trunk/python-ogre/ThirdParty/caelum/CaelumExceptions.h trunk/python-ogre/ThirdParty/caelum/CaelumPrecompiled.cpp trunk/python-ogre/ThirdParty/caelum/CaelumPrecompiled.h trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h trunk/python-ogre/ThirdParty/caelum/CaelumSystem.cpp trunk/python-ogre/ThirdParty/caelum/CaelumSystem.h trunk/python-ogre/ThirdParty/caelum/CameraBoundElement.cpp trunk/python-ogre/ThirdParty/caelum/CameraBoundElement.h trunk/python-ogre/ThirdParty/caelum/CloudSystem.cpp trunk/python-ogre/ThirdParty/caelum/CloudSystem.h trunk/python-ogre/ThirdParty/caelum/FlatCloudLayer.cpp trunk/python-ogre/ThirdParty/caelum/FlatCloudLayer.h trunk/python-ogre/ThirdParty/caelum/GeometryFactory.cpp trunk/python-ogre/ThirdParty/caelum/GeometryFactory.h trunk/python-ogre/ThirdParty/caelum/GroundFog.cpp trunk/python-ogre/ThirdParty/caelum/GroundFog.h trunk/python-ogre/ThirdParty/caelum/ImageHelper.cpp trunk/python-ogre/ThirdParty/caelum/ImageHelper.h trunk/python-ogre/ThirdParty/caelum/ImageStarfield.cpp trunk/python-ogre/ThirdParty/caelum/ImageStarfield.h trunk/python-ogre/ThirdParty/caelum/Moon.cpp trunk/python-ogre/ThirdParty/caelum/Moon.h trunk/python-ogre/ThirdParty/caelum/PointStarfield.cpp trunk/python-ogre/ThirdParty/caelum/PointStarfield.h trunk/python-ogre/ThirdParty/caelum/PrecipitationController.cpp trunk/python-ogre/ThirdParty/caelum/PrecipitationController.h trunk/python-ogre/ThirdParty/caelum/SkyDome.cpp trunk/python-ogre/ThirdParty/caelum/SkyDome.h trunk/python-ogre/ThirdParty/caelum/SkyLight.cpp trunk/python-ogre/ThirdParty/caelum/SkyLight.h trunk/python-ogre/ThirdParty/caelum/Sun.cpp trunk/python-ogre/ThirdParty/caelum/Sun.h trunk/python-ogre/ThirdParty/caelum/UniversalClock.cpp trunk/python-ogre/ThirdParty/caelum/UniversalClock.h trunk/python-ogre/ThirdParty/forests/BatchPage.cpp trunk/python-ogre/ThirdParty/forests/BatchPage.h trunk/python-ogre/ThirdParty/forests/BatchedGeometry.cpp trunk/python-ogre/ThirdParty/forests/BatchedGeometry.h trunk/python-ogre/ThirdParty/forests/GrassLoader.cpp trunk/python-ogre/ThirdParty/forests/GrassLoader.h trunk/python-ogre/ThirdParty/forests/ImpostorPage.cpp trunk/python-ogre/ThirdParty/forests/ImpostorPage.h trunk/python-ogre/ThirdParty/forests/PagedGeometry.cpp trunk/python-ogre/ThirdParty/forests/PagedGeometry.h trunk/python-ogre/ThirdParty/forests/PropertyMaps.cpp trunk/python-ogre/ThirdParty/forests/PropertyMaps.h trunk/python-ogre/ThirdParty/forests/StaticBillboardSet.cpp trunk/python-ogre/ThirdParty/forests/StaticBillboardSet.h trunk/python-ogre/ThirdParty/forests/TreeLoader2D.cpp trunk/python-ogre/ThirdParty/forests/TreeLoader2D.h trunk/python-ogre/ThirdParty/forests/TreeLoader3D.cpp trunk/python-ogre/ThirdParty/forests/TreeLoader3D.h trunk/python-ogre/ThirdParty/forests/WindBatchPage.cpp trunk/python-ogre/ThirdParty/forests/WindBatchPage.h trunk/python-ogre/ThirdParty/forests/WindBatchedGeometry.cpp trunk/python-ogre/ThirdParty/forests/WindBatchedGeometry.h trunk/python-ogre/ThirdParty/forests/orig/ Removed Paths: ------------- trunk/python-ogre/ThirdParty/caelum/Astronomy.cpp trunk/python-ogre/ThirdParty/caelum/Astronomy.h trunk/python-ogre/ThirdParty/caelum/BrightStarCatalogue.cpp trunk/python-ogre/ThirdParty/caelum/Caelum.h trunk/python-ogre/ThirdParty/caelum/CaelumExceptions.h trunk/python-ogre/ThirdParty/caelum/CaelumPrecompiled.cpp trunk/python-ogre/ThirdParty/caelum/CaelumPrecompiled.h trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h trunk/python-ogre/ThirdParty/caelum/CaelumSystem.cpp trunk/python-ogre/ThirdParty/caelum/CaelumSystem.h trunk/python-ogre/ThirdParty/caelum/CameraBoundElement.cpp trunk/python-ogre/ThirdParty/caelum/CameraBoundElement.h trunk/python-ogre/ThirdParty/caelum/GeometryFactory.cpp trunk/python-ogre/ThirdParty/caelum/GeometryFactory.h trunk/python-ogre/ThirdParty/caelum/GroundFog.cpp trunk/python-ogre/ThirdParty/caelum/GroundFog.h trunk/python-ogre/ThirdParty/caelum/ImageHelper.cpp trunk/python-ogre/ThirdParty/caelum/ImageHelper.h trunk/python-ogre/ThirdParty/caelum/ImageStarfield.cpp trunk/python-ogre/ThirdParty/caelum/ImageStarfield.h trunk/python-ogre/ThirdParty/caelum/LayeredClouds.cpp trunk/python-ogre/ThirdParty/caelum/LayeredClouds.h trunk/python-ogre/ThirdParty/caelum/Moon.cpp trunk/python-ogre/ThirdParty/caelum/Moon.h trunk/python-ogre/ThirdParty/caelum/PointStarfield.cpp trunk/python-ogre/ThirdParty/caelum/PointStarfield.h trunk/python-ogre/ThirdParty/caelum/SkyColourModel.cpp trunk/python-ogre/ThirdParty/caelum/SkyColourModel.h trunk/python-ogre/ThirdParty/caelum/SkyDome.cpp trunk/python-ogre/ThirdParty/caelum/SkyDome.h trunk/python-ogre/ThirdParty/caelum/SkyLight.cpp trunk/python-ogre/ThirdParty/caelum/SkyLight.h trunk/python-ogre/ThirdParty/caelum/SolarSystemModel.cpp trunk/python-ogre/ThirdParty/caelum/SolarSystemModel.h trunk/python-ogre/ThirdParty/caelum/Starfield.cpp trunk/python-ogre/ThirdParty/caelum/Starfield.h trunk/python-ogre/ThirdParty/caelum/Sun.cpp trunk/python-ogre/ThirdParty/caelum/Sun.h trunk/python-ogre/ThirdParty/caelum/UniversalClock.cpp trunk/python-ogre/ThirdParty/caelum/UniversalClock.h trunk/python-ogre/ThirdParty/forests/BatchPage.cpp trunk/python-ogre/ThirdParty/forests/BatchPage.h trunk/python-ogre/ThirdParty/forests/BatchedGeometry.cpp trunk/python-ogre/ThirdParty/forests/BatchedGeometry.h trunk/python-ogre/ThirdParty/forests/GrassLoader.cpp trunk/python-ogre/ThirdParty/forests/GrassLoader.h trunk/python-ogre/ThirdParty/forests/ImpostorPage.cpp trunk/python-ogre/ThirdParty/forests/ImpostorPage.h trunk/python-ogre/ThirdParty/forests/PagedGeometry.cpp trunk/python-ogre/ThirdParty/forests/PagedGeometry.h trunk/python-ogre/ThirdParty/forests/PropertyMaps.cpp trunk/python-ogre/ThirdParty/forests/PropertyMaps.h trunk/python-ogre/ThirdParty/forests/StaticBillboardSet.cpp trunk/python-ogre/ThirdParty/forests/StaticBillboardSet.h trunk/python-ogre/ThirdParty/forests/TreeLoader2D.cpp trunk/python-ogre/ThirdParty/forests/TreeLoader2D.h trunk/python-ogre/ThirdParty/forests/TreeLoader3D.cpp trunk/python-ogre/ThirdParty/forests/TreeLoader3D.h trunk/python-ogre/ThirdParty/forests/orig/ Modified: trunk/python-ogre/PythonOgreConfig_nt.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_nt.py 2008-07-30 04:14:17 UTC (rev 680) +++ trunk/python-ogre/PythonOgreConfig_nt.py 2008-08-01 03:24:34 UTC (rev 681) @@ -43,7 +43,7 @@ PATH_OIS = os.path.join(BASE_DIR, 'ois' ) ##'ois-1.0RC1') PATH_Newton = os.path.join(BASE_DIR, 'newtonsdk','sdk') PATH_FMOD = os.path.join(BASE_DIR, 'fmod') -PATH_ODE = os.path.join(BASE_DIR, 'ode-0.9') +PATH_ODE = os.path.join(BASE_DIR, 'ode-0.10.1') PATH_OGG = os.path.join(BASE_DIR, 'ogg') PATH_VORBIS= os.path.join(BASE_DIR, 'vorbis') PATH_OPENAL= os.path.join(BASE_DIR, 'openal') @@ -100,7 +100,7 @@ PATH_LIB_Newton = os.path.join( PATH_Newton ,'dll') ##NOTE Posix platforms this lives in 'lib-mt' PATH_LIB_OIS = os.path.join( PATH_OIS, 'lib') ## NOTE Posix platforms this lives in'lib' not 'dll' PATH_LIB_CEGUI = os.path.join( PATH_CEGUI, 'lib' ) -PATH_LIB_ODE = os.path.join( PATH_ODE, 'lib/releaselib')## probable releaselib for posix +PATH_LIB_ODE = os.path.join( PATH_ODE, 'lib/ReleaseSingleLib')## probable releaselib for posix PATH_LIB_OPCODE = os.path.join( PATH_OPCODE ) PATH_LIB_OgreOde = os.path.join( PATH_OgreOde, 'lib/Release') # # PATH_LIB_OgreBullet = os.path.join( PATH_OgreBullet, 'lib/Release') Modified: trunk/python-ogre/PythonOgreConfig_posix.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_posix.py 2008-07-30 04:14:17 UTC (rev 680) +++ trunk/python-ogre/PythonOgreConfig_posix.py 2008-08-01 03:24:34 UTC (rev 681) @@ -78,6 +78,7 @@ PATH_particleuniverse = os.path.join(PATH_Ogre, 'PlugIns', 'ParticleUniverse' ) PATH_cadunetree= os.path.join(PATH_THIRDPARTY, 'cadunetree') PATH_opensteer = os.path.join(BASE_DIR, 'opensteer', 'trunk') +PATH_ogrepcz = os.path.join(PATH_Ogre, 'PlugIns', 'PCZSceneManager' ) ### @@ -117,6 +118,7 @@ PATH_LIB_navi= os.path.join(PATH_navi, 'lib') PATH_LIB_particleuniverse = os.path.join(PATH_particleuniverse, 'bin', 'release') PATH_LIB_opensteer = os.path.join(LOCAL_LIB) +PATH_INCLUDE_ogrepcz = os.path.join(PATH_ogrepcz,'include') PATH_INCLUDE_Ogre= os.path.join(LOCAL_INCLUDE,'OGRE') # os.path.join(PATH_Ogre,'OgreMain/include') Deleted: trunk/python-ogre/ThirdParty/caelum/Astronomy.cpp =================================================================== --- trunk/python-ogre/ThirdParty/caelum/Astronomy.cpp 2008-07-30 04:14:17 UTC (rev 680) +++ trunk/python-ogre/ThirdParty/caelum/Astronomy.cpp 2008-08-01 03:24:34 UTC (rev 681) @@ -1,350 +0,0 @@ -/* -This file is part of Caelum. -See http://www.ogre3d.org/wiki/index.php/Caelum - -Copyright (c) 2008 Caelum team. See Contributors.txt for details. - -Caelum is free software: you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published -by the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Caelum is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with Caelum. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include "CaelumPrecompiled.h" -#include "Astronomy.h" - -namespace caelum -{ - const LongReal Astronomy::PI = 3.1415926535897932384626433832795029L; - - const LongReal Astronomy::J2000 = 2451545.0; - - LongReal Astronomy::radToDeg (LongReal value) - { - return value * 180 / PI; - } - - LongReal Astronomy::degToRad (LongReal value) - { - return value * PI / 180; - } - - LongReal Astronomy::sinDeg (LongReal x) { - return std::sin (degToRad (x)); - } - - LongReal Astronomy::cosDeg (LongReal x) { - return std::cos (degToRad (x)); - } - - LongReal Astronomy::atan2Deg (LongReal y, LongReal x) { - return radToDeg(std::atan2 (y, x)); - } - - LongReal Astronomy::normalizeDegrees (LongReal value) - { - value = fmod (value, 360); - if (value < LongReal (0)) { - value += LongReal (360); - } - return value; - } - - void Astronomy::convertEclipticToEquatorialRad ( - LongReal lon, LongReal lat, - LongReal &rasc, LongReal &decl) - { - double ecl = Astronomy::degToRad(23.439281); - - double x = cos(lon) * cos(lat); - double y = cos(ecl) * sin(lon) * cos(lat) - sin(ecl) * sin(lat); - double z = sin(ecl) * sin(lon) * cos(lat) + cos(ecl) * sin(lat); - - double r = sqrt(x * x + y * y); - rasc = atan2(y, x); - decl = atan2(z, r); - } - - void Astronomy::convertRectangularToSpherical ( - LongReal x, LongReal y, LongReal z, - LongReal &rasc, LongReal &decl, LongReal &dist) - { - dist = sqrt (x * x + y * y + z * z); - rasc = atan2Deg (y, x); - decl = atan2Deg (z, sqrt (x * x + y * y)); - } - - void Astronomy::convertSphericalToRectangular ( - LongReal rasc, LongReal decl, LongReal dist, - LongReal &x, LongReal &y, LongReal &z) - { - x = dist * cosDeg (rasc) * cosDeg (decl); - y = dist * sinDeg (rasc) * cosDeg (decl); - z = dist * sinDeg (decl); - } - - void Astronomy::convertEquatorialToHorizontal ( - LongReal jday, - LongReal longitude, LongReal latitude, - LongReal rasc, LongReal decl, - LongReal &azimuth, LongReal &altitude) - { - LongReal d = jday - 2451543.5; - LongReal w = LongReal (282.9404 + 4.70935E-5 * d); - LongReal M = LongReal (356.0470 + 0.9856002585 * d); - // Sun's mean longitude - LongReal L = w + M; - // Universal time of day in degrees. - LongReal UT = LongReal(fmod(d, 1) * 360); - LongReal hourAngle = longitude + L + LongReal (180) + UT - rasc; - - LongReal x = cosDeg (hourAngle) * cosDeg (decl); - LongReal y = sinDeg (hourAngle) * cosDeg (decl); - LongReal z = sinDeg (decl); - - LongReal xhor = x * sinDeg (latitude) - z * cosDeg (latitude); - LongReal yhor = y; - LongReal zhor = x * cosDeg (latitude) + z * sinDeg (latitude); - - azimuth = atan2Deg (yhor, xhor) + LongReal (180); - altitude = atan2Deg (zhor, sqrt (xhor * xhor + yhor * yhor)); - } - - void Astronomy::getHorizontalSunPosition ( - LongReal jday, - LongReal longitude, LongReal latitude, - LongReal &azimuth, LongReal &altitude) - { - // 2451544.5 == Astronomy::getJulianDayFromGregorianDateTime(2000, 1, 1, 0, 0, 0)); - // 2451543.5 == Astronomy::getJulianDayFromGregorianDateTime(1999, 12, 31, 0, 0, 0)); - LongReal d = jday - 2451543.5; - - // Sun's Orbital elements: - // argument of perihelion - LongReal w = LongReal (282.9404 + 4.70935E-5 * d); - // eccentricity (0=circle, 0-1=ellipse, 1=parabola) - LongReal e = 0.016709 - 1.151E-9 * d; - // mean anomaly (0 at perihelion; increases uniformly with time) - LongReal M = LongReal(356.0470 + 0.9856002585 * d); - // Obliquity of the ecliptic. - //LongReal oblecl = LongReal (23.4393 - 3.563E-7 * d); - - // Eccentric anomaly - LongReal E = M + radToDeg(e * sinDeg (M) * (1 + e * cosDeg (M))); - - // Sun's Distance(R) and true longitude(L) - LongReal xv = cosDeg (E) - e; - LongReal yv = sinDeg (E) * sqrt (1 - e * e); - //LongReal r = sqrt (xv * xv + yv * yv); - LongReal lon = atan2Deg (yv, xv) + w; - LongReal lat = 0; - - LongReal lambda = degToRad(lon); - LongReal beta = degToRad(lat); - LongReal rasc, decl; - convertEclipticToEquatorialRad (lambda, beta, rasc, decl); - rasc = radToDeg(rasc); - decl = radToDeg(decl); - - // Horizontal spherical. - Astronomy::convertEquatorialToHorizontal ( - jday, longitude, latitude, rasc, decl, azimuth, altitude); - } - - void Astronomy::getHorizontalSunPosition ( - LongReal jday, - Ogre::Degree longitude, Ogre::Degree latitude, - Ogre::Degree &azimuth, Ogre::Degree &altitude) - { - LongReal az, al; - getHorizontalSunPosition(jday, longitude.valueDegrees (), latitude.valueDegrees (), az, al); - azimuth = Ogre::Degree(az); - altitude = Ogre::Degree(al); - } - - void Astronomy::getEclipticMoonPositionRad ( - LongReal jday, - LongReal &lon, LongReal &lat) - { - // Julian centuries since January 1, 2000 - double T = (jday - 2451545.0L) / 36525.0L; - double lprim = 3.8104L + 8399.7091L * T; - double mprim = 2.3554L + 8328.6911L * T; - double m = 6.2300L + 648.3019L * T; - double d = 5.1985L + 7771.3772L * T; - double f = 1.6280L + 8433.4663L * T; - lon = lprim - + 0.1098L * sin(mprim) - + 0.0222L * sin(2.0L * d - mprim) - + 0.0115L * sin(2.0L * d) - + 0.0037L * sin(2.0L * mprim) - - 0.0032L * sin(m) - - 0.0020L * sin(2.0L * f) - + 0.0010L * sin(2.0L * d - 2.0L * mprim) - + 0.0010L * sin(2.0L * d - m - mprim) - + 0.0009L * sin(2.0L * d + mprim) - + 0.0008L * sin(2.0L * d - m) - + 0.0007L * sin(mprim - m) - - 0.0006L * sin(d) - - 0.0005L * sin(m + mprim); - lat = - + 0.0895L * sin(f) - + 0.0049L * sin(mprim + f) - + 0.0048L * sin(mprim - f) - + 0.0030L * sin(2.0L * d - f) - + 0.0010L * sin(2.0L * d + f - mprim) - + 0.0008 * sin(2.0L * d - f - mprim) - + 0.0006L * sin(2.0L * d + f); - } - - void Astronomy::getHorizontalMoonPosition ( - LongReal jday, - LongReal longitude, LongReal latitude, - LongReal &azimuth, LongReal &altitude) - { - // Ecliptic spherical - LongReal lonecl, latecl; - Astronomy::getEclipticMoonPositionRad (jday, lonecl, latecl); - - // Equatorial spherical - LongReal rasc, decl; - Astronomy::convertEclipticToEquatorialRad (lonecl, latecl, rasc, decl); - - // Radians to degrees (all angles are in radians up to this point) - rasc = radToDeg(rasc); - decl = radToDeg(decl); - - // Equatorial to horizontal - Astronomy::convertEquatorialToHorizontal ( - jday, longitude, latitude, rasc, decl, azimuth, altitude); - } - - void Astronomy::getHorizontalMoonPosition ( - LongReal jday, - Ogre::Degree longitude, Ogre::Degree latitude, - Ogre::Degree &azimuth, Ogre::Degree &altitude) - { - LongReal az, al; - getHorizontalMoonPosition(jday, longitude.valueDegrees (), latitude.valueDegrees (), az, al); - azimuth = Ogre::Degree(az); - altitude = Ogre::Degree(al); - } - - int Astronomy::getJulianDayFromGregorianDate( - int year, int month, int day) - { - // Formulas from http://en.wikipedia.org/wiki/Julian_day - // These are all integer divisions, but I'm not sure it works - // correctly for negative values. - int a = (14 - month) / 12; - int y = year + 4800 - a; - int m = month + 12 * a - 3; - return day + (153 * m + 2) / 5 + 365 * y + y / 4 - y / 100 + y / 400 - 32045; - } - - LongReal Astronomy::getJulianDayFromGregorianDateTime( - int year, int month, int day, - int hour, int minute, LongReal second) - { - int fpmode = Astronomy::enterHighPrecissionFloatingPointMode (); - - int jdn = getJulianDayFromGregorianDate (year, month, day); - // These are NOT integer divisions. - LongReal jd = jdn + (hour - 12) / 24.0 + minute / 1440.0 + second / 86400.0; - - Astronomy::restoreFloatingPointMode(fpmode); - return jd; - } - - LongReal Astronomy::getJulianDayFromGregorianDateTime( - int year, int month, int day, - LongReal secondsFromMidnight) - { - int jdn = getJulianDayFromGregorianDate(year, month, day); - LongReal jd = jdn + secondsFromMidnight / 86400.0 - 0.5; - return jd; - } - - void Astronomy::getGregorianDateFromJulianDay( - int julianDay, int &year, int &month, int &day) - { - // From http://en.wikipedia.org/wiki/Julian_day - int J = julianDay; - int j = J + 32044; - int g = j / 146097; - int dg = j % 146097; - int c = (dg / 36524 + 1) * 3 / 4; - int dc = dg - c * 36524; - int b = dc / 1461; - int db = dc % 1461; - int a = (db / 365 + 1) * 3 / 4; - int da = db - a * 365; - int y = g * 400 + c * 100 + b * 4 + a; - int m = (da * 5 + 308) / 153 - 2; - int d = da - (m + 4) * 153 / 5 + 122; - year = y - 4800 + (m + 2) / 12; - month = (m + 2) % 12 + 1; - day = d + 1; - } - - void Astronomy::getGregorianDateTimeFromJulianDay( - LongReal julianDay, int &year, int &month, int &day, - int &hour, int &minute, LongReal &second) - { - // Integer julian days are at noon. - // static_cast<int)(floor( is more precise than Ogre::Math::IFloor. - // Yes, it does matter. - int ijd = static_cast<int>(floor(julianDay + 0.5)); - getGregorianDateFromJulianDay(ijd, year, month, day); - - LongReal s = (julianDay + 0.5 - ijd) * 86400.0; - hour = static_cast<int>(floor(s / 3600)); - s -= hour * 3600; - minute = static_cast<int>(floor(s / 60)); - s -= minute * 60; - second = s; - } - - void Astronomy::getGregorianDateFromJulianDay( - LongReal julianDay, int &year, int &month, int &day) - { - int hour; - int minute; - LongReal second; - getGregorianDateTimeFromJulianDay(julianDay, year, month, day, hour, minute, second); - } - -#if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32) && (OGRE_COMPILER == OGRE_COMPILER_MSVC) - int Astronomy::enterHighPrecissionFloatingPointMode () - { - int oldMode = ::_controlfp (0, 0); - ::_controlfp (_PC_64, _MCW_PC); - return oldMode; - } - - void Astronomy::restoreFloatingPointMode (int oldMode) - { - ::_controlfp (oldMode, _MCW_PC); - } -#else - int Astronomy::enterHighPrecissionFloatingPointMode () - { - // Meaningless - return 0xC0FFEE; - } - - void Astronomy::restoreFloatingPointMode (int oldMode) - { - // Useless check. - assert(oldMode == 0xC0FFEE); - } -#endif -} Added: trunk/python-ogre/ThirdParty/caelum/Astronomy.cpp =================================================================== --- trunk/python-ogre/ThirdParty/caelum/Astronomy.cpp (rev 0) +++ trunk/python-ogre/ThirdParty/caelum/Astronomy.cpp 2008-08-01 03:24:34 UTC (rev 681) @@ -0,0 +1,350 @@ +/* +This file is part of Caelum. +See http://www.ogre3d.org/wiki/index.php/Caelum + +Copyright (c) 2008 Caelum team. See Contributors.txt for details. + +Caelum is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Caelum is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with Caelum. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "CaelumPrecompiled.h" +#include "Astronomy.h" + +namespace Caelum +{ + const LongReal Astronomy::PI = 3.1415926535897932384626433832795029L; + + const LongReal Astronomy::J2000 = 2451545.0; + + LongReal Astronomy::radToDeg (LongReal value) + { + return value * 180 / PI; + } + + LongReal Astronomy::degToRad (LongReal value) + { + return value * PI / 180; + } + + LongReal Astronomy::sinDeg (LongReal x) { + return std::sin (degToRad (x)); + } + + LongReal Astronomy::cosDeg (LongReal x) { + return std::cos (degToRad (x)); + } + + LongReal Astronomy::atan2Deg (LongReal y, LongReal x) { + return radToDeg(std::atan2 (y, x)); + } + + LongReal Astronomy::normalizeDegrees (LongReal value) + { + value = fmod (value, 360); + if (value < LongReal (0)) { + value += LongReal (360); + } + return value; + } + + void Astronomy::convertEclipticToEquatorialRad ( + LongReal lon, LongReal lat, + LongReal &rasc, LongReal &decl) + { + double ecl = Astronomy::degToRad(23.439281); + + double x = cos(lon) * cos(lat); + double y = cos(ecl) * sin(lon) * cos(lat) - sin(ecl) * sin(lat); + double z = sin(ecl) * sin(lon) * cos(lat) + cos(ecl) * sin(lat); + + double r = sqrt(x * x + y * y); + rasc = atan2(y, x); + decl = atan2(z, r); + } + + void Astronomy::convertRectangularToSpherical ( + LongReal x, LongReal y, LongReal z, + LongReal &rasc, LongReal &decl, LongReal &dist) + { + dist = sqrt (x * x + y * y + z * z); + rasc = atan2Deg (y, x); + decl = atan2Deg (z, sqrt (x * x + y * y)); + } + + void Astronomy::convertSphericalToRectangular ( + LongReal rasc, LongReal decl, LongReal dist, + LongReal &x, LongReal &y, LongReal &z) + { + x = dist * cosDeg (rasc) * cosDeg (decl); + y = dist * sinDeg (rasc) * cosDeg (decl); + z = dist * sinDeg (decl); + } + + void Astronomy::convertEquatorialToHorizontal ( + LongReal jday, + LongReal longitude, LongReal latitude, + LongReal rasc, LongReal decl, + LongReal &azimuth, LongReal &altitude) + { + LongReal d = jday - 2451543.5; + LongReal w = LongReal (282.9404 + 4.70935E-5 * d); + LongReal M = LongReal (356.0470 + 0.9856002585 * d); + // Sun's mean longitude + LongReal L = w + M; + // Universal time of day in degrees. + LongReal UT = LongReal(fmod(d, 1) * 360); + LongReal hourAngle = longitude + L + LongReal (180) + UT - rasc; + + LongReal x = cosDeg (hourAngle) * cosDeg (decl); + LongReal y = sinDeg (hourAngle) * cosDeg (decl); + LongReal z = sinDeg (decl); + + LongReal xhor = x * sinDeg (latitude) - z * cosDeg (latitude); + LongReal yhor = y; + LongReal zhor = x * cosDeg (latitude) + z * sinDeg (latitude); + + azimuth = atan2Deg (yhor, xhor) + LongReal (180); + altitude = atan2Deg (zhor, sqrt (xhor * xhor + yhor * yhor)); + } + + void Astronomy::getHorizontalSunPosition ( + LongReal jday, + LongReal longitude, LongReal latitude, + LongReal &azimuth, LongReal &altitude) + { + // 2451544.5 == Astronomy::getJulianDayFromGregorianDateTime(2000, 1, 1, 0, 0, 0)); + // 2451543.5 == Astronomy::getJulianDayFromGregorianDateTime(1999, 12, 31, 0, 0, 0)); + LongReal d = jday - 2451543.5; + + // Sun's Orbital elements: + // argument of perihelion + LongReal w = LongReal (282.9404 + 4.70935E-5 * d); + // eccentricity (0=circle, 0-1=ellipse, 1=parabola) + LongReal e = 0.016709 - 1.151E-9 * d; + // mean anomaly (0 at perihelion; increases uniformly with time) + LongReal M = LongReal(356.0470 + 0.9856002585 * d); + // Obliquity of the ecliptic. + //LongReal oblecl = LongReal (23.4393 - 3.563E-7 * d); + + // Eccentric anomaly + LongReal E = M + radToDeg(e * sinDeg (M) * (1 + e * cosDeg (M))); + + // Sun's Distance(R) and true longitude(L) + LongReal xv = cosDeg (E) - e; + LongReal yv = sinDeg (E) * sqrt (1 - e * e); + //LongReal r = sqrt (xv * xv + yv * yv); + LongReal lon = atan2Deg (yv, xv) + w; + LongReal lat = 0; + + LongReal lambda = degToRad(lon); + LongReal beta = degToRad(lat); + LongReal rasc, decl; + convertEclipticToEquatorialRad (lambda, beta, rasc, decl); + rasc = radToDeg(rasc); + decl = radToDeg(decl); + + // Horizontal spherical. + Astronomy::convertEquatorialToHorizontal ( + jday, longitude, latitude, rasc, decl, azimuth, altitude); + } + + void Astronomy::getHorizontalSunPosition ( + LongReal jday, + Ogre::Degree longitude, Ogre::Degree latitude, + Ogre::Degree &azimuth, Ogre::Degree &altitude) + { + LongReal az, al; + getHorizontalSunPosition(jday, longitude.valueDegrees (), latitude.valueDegrees (), az, al); + azimuth = Ogre::Degree(az); + altitude = Ogre::Degree(al); + } + + void Astronomy::getEclipticMoonPositionRad ( + LongReal jday, + LongReal &lon, LongReal &lat) + { + // Julian centuries since January 1, 2000 + double T = (jday - 2451545.0L) / 36525.0L; + double lprim = 3.8104L + 8399.7091L * T; + double mprim = 2.3554L + 8328.6911L * T; + double m = 6.2300L + 648.3019L * T; + double d = 5.1985L + 7771.3772L * T; + double f = 1.6280L + 8433.4663L * T; + lon = lprim + + 0.1098L * sin(mprim) + + 0.0222L * sin(2.0L * d - mprim) + + 0.0115L * sin(2.0L * d) + + 0.0037L * sin(2.0L * mprim) + - 0.0032L * sin(m) + - 0.0020L * sin(2.0L * f) + + 0.0010L * sin(2.0L * d - 2.0L * mprim) + + 0.0010L * sin(2.0L * d - m - mprim) + + 0.0009L * sin(2.0L * d + mprim) + + 0.0008L * sin(2.0L * d - m) + + 0.0007L * sin(mprim - m) + - 0.0006L * sin(d) + - 0.0005L * sin(m + mprim); + lat = + + 0.0895L * sin(f) + + 0.0049L * sin(mprim + f) + + 0.0048L * sin(mprim - f) + + 0.0030L * sin(2.0L * d - f) + + 0.0010L * sin(2.0L * d + f - mprim) + + 0.0008 * sin(2.0L * d - f - mprim) + + 0.0006L * sin(2.0L * d + f); + } + + void Astronomy::getHorizontalMoonPosition ( + LongReal jday, + LongReal longitude, LongReal latitude, + LongReal &azimuth, LongReal &altitude) + { + // Ecliptic spherical + LongReal lonecl, latecl; + Astronomy::getEclipticMoonPositionRad (jday, lonecl, latecl); + + // Equatorial spherical + LongReal rasc, decl; + Astronomy::convertEclipticToEquatorialRad (lonecl, latecl, rasc, decl); + + // Radians to degrees (all angles are in radians up to this point) + rasc = radToDeg(rasc); + decl = radToDeg(decl); + + // Equatorial to horizontal + Astronomy::convertEquatorialToHorizontal ( + jday, longitude, latitude, rasc, decl, azimuth, altitude); + } + + void Astronomy::getHorizontalMoonPosition ( + LongReal jday, + Ogre::Degree longitude, Ogre::Degree latitude, + Ogre::Degree &azimuth, Ogre::Degree &altitude) + { + LongReal az, al; + getHorizontalMoonPosition(jday, longitude.valueDegrees (), latitude.valueDegrees (), az, al); + azimuth = Ogre::Degree(az); + altitude = Ogre::Degree(al); + } + + int Astronomy::getJulianDayFromGregorianDate( + int year, int month, int day) + { + // Formulas from http://en.wikipedia.org/wiki/Julian_day + // These are all integer divisions, but I'm not sure it works + // correctly for negative values. + int a = (14 - month) / 12; + int y = year + 4800 - a; + int m = month + 12 * a - 3; + return day + (153 * m + 2) / 5 + 365 * y + y / 4 - y / 100 + y / 400 - 32045; + } + + LongReal Astronomy::getJulianDayFromGregorianDateTime( + int year, int month, int day, + int hour, int minute, LongReal second) + { + int fpmode = Astronomy::enterHighPrecissionFloatingPointMode (); + + int jdn = getJulianDayFromGregorianDate (year, month, day); + // These are NOT integer divisions. + LongReal jd = jdn + (hour - 12) / 24.0 + minute / 1440.0 + second / 86400.0; + + Astronomy::restoreFloatingPointMode(fpmode); + return jd; + } + + LongReal Astronomy::getJulianDayFromGregorianDateTime( + int year, int month, int day, + LongReal secondsFromMidnight) + { + int jdn = getJulianDayFromGregorianDate(year, month, day); + LongReal jd = jdn + secondsFromMidnight / 86400.0 - 0.5; + return jd; + } + + void Astronomy::getGregorianDateFromJulianDay( + int julianDay, int &year, int &month, int &day) + { + // From http://en.wikipedia.org/wiki/Julian_day + int J = julianDay; + int j = J + 32044; + int g = j / 146097; + int dg = j % 146097; + int c = (dg / 36524 + 1) * 3 / 4; + int dc = dg - c * 36524; + int b = dc / 1461; + int db = dc % 1461; + int a = (db / 365 + 1) * 3 / 4; + int da = db - a * 365; + int y = g * 400 + c * 100 + b * 4 + a; + int m = (da * 5 + 308) / 153 - 2; + int d = da - (m + 4) * 153 / 5 + 122; + year = y - 4800 + (m + 2) / 12; + month = (m + 2) % 12 + 1; + day = d + 1; + } + + void Astronomy::getGregorianDateTimeFromJulianDay( + LongReal julianDay, int &year, int &month, int &day, + int &hour, int &minute, LongReal &second) + { + // Integer julian days are at noon. + // static_cast<int)(floor( is more precise than Ogre::Math::IFloor. + // Yes, it does matter. + int ijd = static_cast<int>(floor(julianDay + 0.5)); + getGregorianDateFromJulianDay(ijd, year, month, day); + + LongReal s = (julianDay + 0.5 - ijd) * 86400.0; + hour = static_cast<int>(floor(s / 3600)); + s -= hour * 3600; + minute = static_cast<int>(floor(s / 60)); + s -= minute * 60; + second = s; + } + + void Astronomy::getGregorianDateFromJulianDay( + LongReal julianDay, int &year, int &month, int &day) + { + int hour; + int minute; + LongReal second; + getGregorianDateTimeFromJulianDay(julianDay, year, month, day, hour, minute, second); + } + +#if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32) && (OGRE_COMPILER == OGRE_COMPILER_MSVC) + int Astronomy::enterHighPrecissionFloatingPointMode () + { + int oldMode = ::_controlfp (0, 0); + ::_controlfp (_PC_64, _MCW_PC); + return oldMode; + } + + void Astronomy::restoreFloatingPointMode (int oldMode) + { + ::_controlfp (oldMode, _MCW_PC); + } +#else + int Astronomy::enterHighPrecissionFloatingPointMode () + { + // Meaningless + return 0xC0FFEE; + } + + void Astronomy::restoreFloatingPointMode (int oldMode) + { + // Useless check. + assert(oldMode == 0xC0FFEE); + } +#endif +} Deleted: trunk/python-ogre/ThirdParty/caelum/Astronomy.h =================================================================== --- trunk/python-ogre/ThirdParty/caelum/Astronomy.h 2008-07-30 04:14:17 UTC (rev 680) +++ trunk/python-ogre/ThirdParty/caelum/Astronomy.h 2008-08-01 03:24:34 UTC (rev 681) @@ -1,204 +0,0 @@ -/* -This file is part of Caelum. -See http://www.ogre3d.org/wiki/index.php/Caelum - -Copyright (c) 2008 Caelum team. See Contributors.txt for details. - -Caelum is free software: you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published -by the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Caelum is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with Caelum. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef ASTRONOMY_H -#define ASTRONOMY_H - -#include "CaelumPrerequisites.h" - -namespace caelum -{ - /** Static class with astronomy routines. - * This class contains various astronomical routines useful in Caelum. - * - * Most of the formulas are from http://stjarnhimlen.se/comp/ppcomp.html - * That site contains much more than was implemented here; it has code - * for determining the positions of all the planets. Only the sun and - * moon are actually useful for caelum. - * - * The formulas are isolated here in pure procedural code for easier - * testing (Tests are done as assertions in the demo). - * - * Precision is vital here, so this class uses caelum::LongReal(double) - * instead of Ogre::Real(float) for precission. All angles are in degrees - * unless otherwise mentioned. Ogre::Degree and Ogre::Radian use - * Ogre::Real and should be avoided here. - */ - class CAELUM_EXPORT Astronomy - { - private: - Astronomy() {} - - static const LongReal PI; - - /** Normalize an angle to the 0, 360 range. - * @param x The angle to normalize - */ - static LongReal normalizeDegrees (LongReal x); - - /// Convert radians to degrees. - static LongReal radToDeg (LongReal x); - - /// Convert degrees to radians. - static LongReal degToRad (LongReal x); - - static LongReal sinDeg (LongReal x); - static LongReal cosDeg (LongReal x); - static LongReal atan2Deg (LongReal y, LongReal x); - - public: - /// January 1, 2000, noon - static const LongReal J2000; - - /** Convert from ecliptic to ecuatorial spherical coordinates, in radians. - * @param lon Ecliptic longitude - * @param lat Ecliptic latitude - * @param rasc Right ascension - * @param decl Declination - * @warning: This function works in radians. - */ - static void convertEclipticToEquatorialRad ( - LongReal lon, LongReal lat, - LongReal& rasc, LongReal& decl); - - static void convertRectangularToSpherical ( - LongReal x, LongReal y, LongReal z, - LongReal &rasc, LongReal &decl, LongReal &dist); - - static void convertSphericalToRectangular ( - LongReal rasc, LongReal decl, LongReal dist, - LongReal &x, LongReal &y, LongReal &z); - - /** Convert from equatorial to horizontal coordinates. - * This function converts from angles relative to the earth's equator - * to angle relative to the horizon at a given point. - * @param jday Astronomical time as julian day. - * @param longitude Observer's longitude in degrees east. - * @param latitude Observer's latitude in degrees north. - * @param rasc Object's right ascension. - * @param decl Object's declination. - * @param azimuth Object's azimuth (clockwise degrees from true north). - * @param altitude Object's altitude (degrees above the horizon). - */ - static void convertEquatorialToHorizontal ( - LongReal jday, - LongReal longitude, LongReal latitude, - LongReal rasc, LongReal decl, - LongReal &azimuth, LongReal &altitude); - - /** Get the sun's position in the sky in, relative to the horizon. - * @param jday Astronomical time as julian day. - * @param longitude Observer longitude - * @param latitude Observer latitude - * @param azimuth Astronomical azimuth, measured clockwise from North = 0. - * @param altitude Astronomical altitude, elevation above the horizon. - */ - static void getHorizontalSunPosition ( - LongReal jday, - LongReal longitude, LongReal latitude, - LongReal &azimuth, LongReal &altitude); - - static void getHorizontalSunPosition ( - LongReal jday, - Ogre::Degree longitude, Ogre::Degree latitude, - Ogre::Degree &azimuth, Ogre::Degree &altitude); - - /// Gets the moon position at a specific time in ecliptic coordinates - /// @param lon: Ecliptic longitude, in radians. - /// @param lat: Ecliptic latitude, in radians. - static void getEclipticMoonPositionRad ( - LongReal jday, - LongReal &lon, - LongReal &lat); - - static void getHorizontalMoonPosition ( - LongReal jday, - LongReal longitude, LongReal latitude, - LongReal &azimuth, LongReal &altitude); - static void getHorizontalMoonPosition ( - LongReal jday, - Ogre::Degree longitude, Ogre::Degree latitude, - Ogre::Degree &azimuth, Ogre::Degree &altitude); - - /** Get astronomical julian day from normal gregorian calendar. - * From wikipedia: the integer number of days that have elapsed - * since the initial epoch defined as - * noon Universal Time (UT) Monday, January 1, 4713 BC - * @note this is the time at noon, not midnight. - */ - static int getJulianDayFromGregorianDate ( - int year, int month, int day); - - /** Get astronomical julian day from normal gregorian calendar. - * Calculate julian day from a day in the normal gregorian calendar. - * Time should be given as UTC. - * @see http://en.wikipedia.org/wiki/Julian_day - */ - static LongReal getJulianDayFromGregorianDateTime ( - int year, int month, int day, - int hour, int minute, LongReal second); - - /** Get astronomical julian day from normal gregorian calendar. - * @see above (I don't know the proper doxygen syntax). - */ - static LongReal getJulianDayFromGregorianDateTime ( - int year, int month, int day, - LongReal secondsFromMidnight); - - /// Get gregorian date from integer julian day. - static void getGregorianDateFromJulianDay ( - int julianDay, int &year, int &month, int &day); - - /// Get gregorian date time from floating point julian day. - static void getGregorianDateTimeFromJulianDay ( - LongReal julianDay, int &year, int &month, int &day, - int &hour, int &minute, LongReal &second); - - /// Get gregorian date from floating point julian day. - static void getGregorianDateFromJulianDay ( - LongReal julianDay, int &year, int &month, int &day); - - /** Enter high-precission floating-point mode. - * - * By default Direct3D decreases the precission of ALL floating - * point calculations, enough to stop Caelum's astronomy routines - * from working correctly. - * - * To trigger this behaviour in a standard ogre demo select the - * Direct3D render system and set "Floating-point mode" to - * "Fastest". Otherwise it's not a problem. - * - * It can be fixed by changing the precission only inside caelum's - * astronomy routines using the _controlfp function. This only works - * for MSVC on WIN32; This is a no-op on other compilers. - * - * @note: Must be paired with restoreFloatingPointMode. - * @return Value to pass to restoreFloatingModeMode. - */ - static int enterHighPrecissionFloatingPointMode (); - - /** Restore old floating point precission. - * @see enterHighPrecissionFloatingPointMode. - */ - static void restoreFloatingPointMode (int oldMode); - }; -} - -#endif // SOLARSYSTEMMODEL_H Added: trunk/python-ogre/ThirdParty/caelum/Astronomy.h =================================================================== --- trunk/python-ogre/ThirdParty/caelum/Astronomy.h (rev 0) +++ trunk/python-ogre/ThirdParty/caelum/Astronomy.h 2008-08-01 03:24:34 UTC (rev 681) @@ -0,0 +1,204 @@ +/* +This file is part of Caelum. +See http://www.ogre3d.org/wiki/index.php/Caelum + +Copyright (c) 2008 Caelum team. See Contributors.txt for details. + +Caelum is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Caelum is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with Caelum. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef ASTRONOMY_H +#define ASTRONOMY_H + +#include "CaelumPrerequisites.h" + +namespace Caelum +{ + /** Static class with astronomy routines. + * This class contains various astronomical routines useful in Caelum. + * + * Most of the formulas are from http://stjarnhimlen.se/comp/ppcomp.html + * That site contains much more than was implemented here; it has code + * for determining the positions of all the planets. Only the sun and + * moon are actually useful for caelum. + * + * The formulas are isolated here in pure procedural code for easier + * testing (Tests are done as assertions in the demo). + * + * Precision is vital here, so this class uses Caelum::LongReal(double) + * instead of Ogre::Real(float) for precission. All angles are in degrees + * unless otherwise mentioned. Ogre::Degree and Ogre::Radian use + * Ogre::Real and should be avoided here. + */ + class CAELUM_EXPORT Astronomy + { + private: + Astronomy() {} + + static const LongReal PI; + + /** Normalize an angle to the 0, 360 range. + * @param x The angle to normalize + */ + static LongReal normalizeDegrees (LongReal x); + + /// Convert radians to degrees. + static LongReal radToDeg (LongReal x); + + /// Convert degrees to radians. + static LongReal degToRad (LongReal x); + + static LongReal sinDeg (LongReal x); + static LongReal cosDeg (LongReal x); + static LongReal atan2Deg (LongReal y, LongReal x); + + public: + /// January 1, 2000, noon + static const LongReal J2000; + + /** Convert from ecliptic to ecuatorial spherical coordinates, in radians. + * @param lon Ecliptic longitude + * @param lat Ecliptic latitude + * @param rasc Right ascension + * @param decl Declination + * @warning: This function works in radians. + */ + static void convertEclipticToEquatorialRad ( + LongReal lon, LongReal lat, + LongReal& rasc, LongReal& decl); + + static void convertRectangularToSpherical ( + LongReal x, LongReal y, LongReal z, + LongReal &rasc, LongReal &decl, LongReal &dist); + + static void convertSphericalToRectangular ( + LongReal rasc, LongReal decl, LongReal dist, + LongReal &x, LongReal &y, LongReal &z); + + /** Convert from equatorial to horizontal coordinates. + * This function converts from angles relative to the earth's equator + * to angle relative to the horizon at a given point. + * @param jday Astronomical time as julian day. + * @param longitude Observer's longitude in degrees east. + * @param latitude Observer's latitude in degrees north. + * @param rasc Object's right ascension. + * @param decl Object's declination. + * @param azimuth Object's azimuth (clockwise degrees from true north). + * @param altitude Object's altitude (degrees above the horizon). + */ + static void convertEquatorialToHorizontal ( + LongReal jday, + LongReal longitude, LongReal latitude, + LongReal rasc, LongReal decl, + LongReal &azimuth, LongReal &altitude); + + /** Get the sun's position in the sky in, relative to the horizon. + * @param jday Astronomical time as julian day. + * @param longitude Observer longitude + * @param latitude Observer latitude + * @param azimuth Astronomical azimuth, measured clockwise from North = 0. + * @param altitude Astronomical altitude, elevation above the horizon. + */ + static void getHorizontalSunPosition ( + LongReal jday, + LongReal longitude, LongReal latitude, + LongReal &azimuth, LongReal &altitude); + + static void getHorizontalSunPosition ( + LongReal jday, + Ogre::Degree longitude, Ogre::Degree latitude, + Ogre::Degree &azimuth, Ogre::Degree &altitude); + + /// Gets the moon position at a specific time in ecliptic coordinates + /// @param lon: Ecliptic longitude, in radians. + /// @param lat: Ecliptic latitude, in radians. + static void getEclipticMoonPositionRad ( + LongReal jday, + LongReal &lon, + LongReal &lat); + + static void getHorizontalMoonPosition ( + LongReal jday, + LongReal longitude, LongReal latitude, + LongReal &azimuth, LongReal &altitude); + static void getHorizontalMoonPosition ( + LongReal jday, + Ogre::Degree longitude, Ogre::Degree latitude, + Ogre::Degree &azimuth, Ogre::Degree &altitude); + + /** Get astronomical julian day from normal gregorian calendar. + * From wikipedia: the integer number of days that have elapsed + * since the initial epoch defined as + * noon Universal Time (UT) Monday, January 1, 4713 BC + * @note this is the time at noon, not midnight. + */ + static int getJulianDayFromGregorianDate ( + int year, int month, int day); + + /** Get astronomical julian day from normal gregorian calendar. + * Calculate julian day from a day in the normal gregorian calendar. + * Time should be given as UTC. + * @see http://en.wikipedia.org/wiki/Julian_day + */ + static LongReal getJulianDayFromGregorianDateTime ( + int year, int month, int day, + int hour, int minute, LongReal second); + + /** Get astronomical julian day from normal gregorian calendar. + * @see above (I don't know the proper doxygen syntax). + */ + static LongReal getJulianDayFromGregorianDateTime ( + int year, int month, int day, + LongReal secondsFromMidnight); + + /// Get gregorian date from integer julian day. + static void getGregorianDateFromJulianDay ( + int julianDay, int &year, int &month, int &day); + + /// Get gregorian date time from floating point julian day. + static void getGregorianDateTimeFromJulianDay ( + LongReal julianDay, int &year, int &month, int &day, + int &hour, int &minute, LongReal &second); + + /// Get gregorian date from floating point julian day. + static void getGregorianDateFromJulianDay ( + LongReal julianDay, int &year, int &month, int &day); + + /** Enter high-precission floating-point mode. + * + * By default Direct3D decreases the precission of ALL floating + * point calculations, enough to stop Caelum's astronomy routines + * from working correctly. + * + * To trigger this behaviour in a standard ogre demo select the + * Direct3D render system and set "Floating-point mode" to + * "Fastest". Otherwise it's not a problem. + * + * It can be fixed by changing the precission only inside caelum's + * astronomy routines using the _controlfp function. This only works + * for MSVC on WIN32; This is a no-op on other compilers. + * + * @note: Must be paired with restoreFloatingPointMode. + * @return Value to pass to restoreFloatingModeMode. + */ + static int enterHighPrecissionFloatingPointMode (); + + /** Restore old floating point precission. + * @see enterHighPrecissionFloatingPointMode. + */ + static void restoreFloatingPointMode (int oldMode); + }; +} + +#endif // SOLARSYSTEMMODEL_H Deleted: trunk/python-ogre/ThirdParty/caelum/BrightStarCatalogue.cpp =================================================================== --- trunk/python-ogre/ThirdParty/caelum/BrightStarCatalogue.cpp 2008-07-30 04:14:17 UTC (rev 680) +++ trunk/python-ogre/ThirdParty/caelum/BrightStarCatalogue.cpp 2008-08-01 03:24:34 UTC (rev 681) @@ -1,9140 +0,0 @@ -/* -This file is part of Caelum. -See http://www.ogre3d.org/wiki/index.php/Caelum - -Copyright (c) 2008 Caelum team. See Contributors.txt for details. - -Caelum is free software: you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published -by the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Caelum is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with Caelum. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include "CaelumPrecompiled.h" -#include "PointStarfield.h" - -// Data from http://heasarc.gsfc.nasa.gov/W3Browse/star-catalog/bsc5p.html -// Converted using the following MSVS regexps: -// ^\|0*{:d+} 0*{:d+} 0*{[0-9.]+}\|{[+\-]}0*{:d+} 0*{:d+} 0*{[0-9.]+}\|{.*}\|$ -// { \(2,1), \(2,2), \(5,3), \4\(2,5), \(2,6), \(4,7),\(5, 8) }, -const caelum::BrightStarCatalogueEntry caelum::BrightStarCatalogue[BrightStarCatalogueSize] = { - { 21, 8, 46.20, -88, 57, 23.0, 5.47 }, - { 22, 45, 28.61, -88, 49, 5.9, 6.57 }, - { 15, 28, 19.10, -88, 7, 59.2, 6.48 }, - { 18, 54, 46.90, -87, 36, 20.9, 5.28 }, - { 17, 15, 59.30, -87, 33, 59.0, 6.57 }, - { 23, 28, 3.70, -87, 28, 55.9, 5.49 }, - { 6, 46, 58.70, -87, 1, 30.0, 6.47 }, - { 17, 0, 58.49, -86, 21, 51.8, 6.04 }, - { 12, 25, 37.49, -86, 9, 2.2, 6.33 }, - { 22, 31, 37.39, -85, 58, 1.9, 5.77 }, - { 13, 40, 55.49, -85, 47, 10.0, 5.58 }, - { 8, 56, 41.09, -85, 39, 47.2, 5.42 }, - { 12, 2, 20.11, -85, 37, 54.1, 6.05 }, - { 3, 42, 32.11, -85, 15, 43.9, 6.41 }, - { 18, 1, 34.10, -85, 12, 52.9, 6.45 }, - { 12, 54, 58.61, -85, 7, 23.9, 5.46 }, - { 0, 13, 19.39, -84, 59, 39.1, 5.77 }, - { 21, 32, 4.20, -84, 48, 36.0, 6.45 }, - { 15, 11, 8.30, -84, 47, 15.0, 5.91 }, - { 5, 30, 13.90, -84, 47, 6.0, 6.20 }, - { 1, 37, 28.01, -84, 46, 10.9, 5.69 }, - { 10, 59, 13.80, -84, 35, 38.0, 6.19 }, - { 15, 43, 16.80, -84, 27, 55.1, 5.57 }, - { 14, 26, 54.89, -83, 40, 4.1, 4.32 }, - { 18, 51, 57.89, -83, 18, 59.0, 7.16 }, - { 20, 24, 54.41, -83, 18, 38.2, 6.17 }, - { 16, 45, 53.59, -83, 14, 20.0, 6.57 }, - { 15, 1, 50.81, -83, 13, 40.1, 5.65 }, - { 11, 41, 1.20, -83, 6, .0, 6.33 }, - { 15, 4, 46.70, -83, 2, 17.9, 5.65 }, - { 1, 37, 55.61, -82, 58, 30.0, 5.87 }, - { 4, 22, 50.90, -82, 53, 57.1, 6.76 }, - { 14, 24, 23.30, -82, 50, 55.0, 6.42 }, - { 21, 50, 54.31, -82, 43, 9.1, 5.29 }, - { 21, 33, 54.41, -82, 40, 59.2, 6.38 }, - { 13, 55, 38.71, -82, 39, 58.0, 5.95 }, - { 4, 58, 50.90, -82, 28, 14.2, 5.85 }, - { 0, 10, 2.09, -82, 13, 26.0, 5.28 }, - { 10, 0, 43.70, -82, 12, 52.9, 5.52 }, - { 23, 57, 32.71, -82, 10, 12.0, 5.73 }, - { 23, 52, 6.41, -82, 1, 8.0, 5.11 }, - { 10, 31, 51.00, -81, 55, 16.0, 7.07 }, - { 18, 42, 14.09, -81, 48, 28.1, 6.27 }, - { 4, 20, 57.89, -81, 34, 48.0, 5.79 }, - { 10, 4, 7.61, -81, 33, 56.9, 6.60 }, - { 10, 59, 12.91, -81, 33, 22.0, 6.71 }, - { 5, 12, 25.70, -81, 32, 30.1, 6.51 }, - { 18, 5, 26.69, -81, 29, 11.0, 6.35 }, - { 22, 46, 3.31, -81, 22, 54.1, 4.15 }, - { 19, 56, 1.51, -81, 20, 58.9, 6.39 }, - { 20, 38, 18.60, -81, 17, 20.0, 5.91 }, - { 14, 18, 13.80, -81, 0, 28.1, 4.91 }, - { 20, 33, 17.50, -80, 57, 54.0, 5.77 }, - { 9, 33, 53.21, -80, 56, 29.0, 5.11 }, - { 8, 24, 19.80, -80, 54, 51.1, 5.69 }, - { 23, 12, 12.00, -80, 54, 46.1, 6.41 }, - { 17, 31, 27.29, -80, 51, 33.1, 5.88 }, - { 6, 40, 2.71, -80, 48, 49.0, 5.64 }, - { 9, 24, 9.10, -80, 47, 12.8, 5.36 }, - { 10, 45, 46.80, -80, 32, 25.1, 4.45 }, - { 10, 45, 15.70, -80, 28, 10.9, 5.47 }, - { 5, 37, 9.79, -80, 28, 9.1, 5.65 }, - { 22, 20, 1.51, -80, 26, 22.9, 5.10 }, - { 18, 29, 19.49, -80, 13, 58.1, 5.95 }, - { 4, 17, 59.09, -80, 12, 50.0, 5.69 }, - { 1, 47, 46.51, -80, 10, 36.1, 6.06 }, - { 22, 50, 22.90, -80, 7, 27.1, 5.35 }, - { 14, 22, 22.70, -80, 6, 32.0, 5.06 }, - { 21, 33, 20.59, -80, 2, 21.1, 6.47 }, - { 10, 41, 51.29, -79, 46, 59.9, 5.97 }, - { 11, 18, 34.30, -79, 40, 7.0, 6.35 }, - { 10, 52, 27.50, -79, 33, 33.8, 6.33 }, - { 8, 45, 55.20, -79, 30, 15.8, 5.79 }, - { 23, 8, 23.71, -79, 28, 50.9, 6.12 }, - { 23, 19, 8.11, -79, 28, 22.1, 6.33 }, - { 21, 38, 56.21, -79, 26, 33.0, 6.18 }, - { 6, 56, 34.39, -79, 25, 13.1, 5.45 }, - { 5, 50, 16.70, -79, 21, 41.0, 5.47 }, - { 12, 18, 20.69, -79, 18, 43.9, 4.26 }, - { 11, 42, 55.39, -79, 18, 23.0, 6.39 }, - { 1, 41, 21.31, -79, 8, 53.9, 6.33 }, - { 2, 31, 40.51, -79, 6, 33.8, 5.28 }, - { 7, 25, 37.99, -79, 5, 39.1, 5.53 }, - { 8, 43, 12.41, -79, 4, 10.9, 6.05 }, - { 14, 47, 51.60, -79, 2, 40.9, 3.83 }, - { 3, 7, 31.99, -78, 59, 21.8, 5.57 }, - { 8, 41, 19.51, -78, 57, 47.9, 5.47 }, - { 16, 33, 27.00, -78, 53, 49.9, 3.89 }, - { 5, 35, 36.31, -78, 49, 14.9, 6.05 }, - { 23, 44, 40.70, -78, 47, 29.0, 5.75 }, - { 0, 16, 49.01, -78, 46, 50.2, 6.77 }, - { 22, 35, 26.40, -78, 46, 18.1, 6.15 }, - { 16, 20, 20.81, -78, 41, 44.9, 4.68 }, - { 16, 20, 26.81, -78, 40, 1.9, 5.27 }, - { 10, 35, 28.10, -78, 36, 28.1, 4.11 }, - { 14, 0, 32.81, -78, 35, 24.0, 6.09 }, - { 12, 13, 55.70, -78, 34, 25.0, 6.35 }, - { 1, 33, 39.19, -78, 30, 16.9, 6.11 }, - { 13, 14, 17.21, -78, 26, 49.9, 5.85 }, - { 3, 29, 58.80, -78, 21, 6.8, 5.70 }, - { 1, 55, 50.50, -78, 20, 53.9, 6.16 }, - { 3, 36, 30.00, -78, 19, 23.2, 6.29 }, - { 5, 0, 13.20, -78, 18, 1.1, 6.29 }, - { 11, 59, 37.30, -78, 13, 18.8, 4.91 }, - { 15, 39, 18.29, -77, 55, 5.2, 6.18 }, - { 18, 47, 49.39, -77, 52, 1.9, 6.39 }, - { 14, 16, 54.89, -77, 39, 50.0, 6.47 }, - { 22, 1, 52.10, -77, 39, 45.0, 6.41 }, - { 4, 38, 21.70, -77, 39, 22.0, 6.05 }, - { 7, 36, 4.20, -77, 38, 3.1, 6.18 }, - { 11, 21, 57.10, -77, 36, 29.9, 6.43 }, - { 13, 33, 14.81, -77, 34, 5.9, 6.48 }, - { 16, 43, 4.61, -77, 31, 3.0, 4.24 }, - { 22, 17, 50.50, -77, 30, 42.1, 5.51 }, - { 8, 20, 38.50, -77, 29, 3.8, 4.35 }, - { 0, 21, 28.61, -77, 25, 36... [truncated message content] |