Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

mathlib.h File Reference

#include <cmath>
#include <stdlib.h>

Include dependency graph for mathlib.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define PI   3.14159265358979323846

Typedefs

typedef Math< double > Mathd
typedef Math< float > Mathf

Functions

template<class T>
abs (T x)
template<class T>
circleArea (T r)
template<class T>
clamp (T x)
template<class T>
cube (T x)
template<class T>
degToRad (T d)
template<class T>
pfmod (T x, T y)
template<class T>
radToDeg (T r)
template<class T>
sign (T x)
template<class T>
sphereArea (T r)
template<class T>
square (T x)


Define Documentation

#define PI   3.14159265358979323846
 

Definition at line 16 of file mathlib.h.

Referenced by astro::anomaly(), Body::cartesianToPlanetocentric(), circleArea(), Observer::computeCenterCOParameters(), computePlanetCoords(), VSOP87Orbit::computePosition(), CallistoOrbit::computePosition(), GanymedeOrbit::computePosition(), EuropaOrbit::computePosition(), IoOrbit::computePosition(), PlutoOrbit::computePosition(), NeptuneOrbit::computePosition(), UranusOrbit::computePosition(), SaturnOrbit::computePosition(), JupiterOrbit::computePosition(), MarsOrbit::computePosition(), LunarOrbit::computePosition(), EarthOrbit::computePosition(), VenusOrbit::computePosition(), MercuryOrbit::computePosition(), SphereMesh::createSphere(), degToRad(), EclipseFinderProc(), eclipseGoto(), EclipticToEquatorial(), astro::equatorialToCelestialCart(), RotationElements::equatorialToPlanetographic(), Body::getEquatorialToGeographic(), UranianSatelliteOrbit::getPeriod(), Observer::getSelectionLongLat(), Url::goTo(), EclipseFinderDlg::gotoEclipse(), Observer::gotoSelectionLongLat(), InitTrigArrays(), log(), NoiseDisplacementFunc(), Observer::Observer(), Universe::pickDeepSkyObject(), Universe::pickStar(), Body::planetocentricToCartesian(), EllipticalOrbit::positionAtTime(), radToDeg(), renderAtmosphere(), renderBumpMappedMesh(), Renderer::renderCometTail(), renderCompass(), Renderer::renderEllipsoidAtmosphere(), Galaxy::renderGalaxyEllipsoid(), Renderer::renderObject(), Renderer::renderPlanet(), renderRings(), renderRings_GLSL(), renderSmoothMesh(), Renderer::renderStar(), Observer::reverseOrientation(), EllipticalOrbit::sample(), sphereArea(), StateVectorToOrbit(), and Observer::update().


Typedef Documentation

typedef Math<double> Mathd
 

Definition at line 34 of file mathlib.h.

typedef Math<float> Mathf
 

Definition at line 33 of file mathlib.h.


Function Documentation

template<class T>
T abs x  ) 
 

Definition at line 47 of file mathlib.h.

Referenced by astro::anomaly(), confAmbientLight(), confGalaxyLightGain(), confVisualMagnitude(), displayDistance(), displayLocationInfo(), distance(), dsoStraddlesNodesPredicate(), SelectionPopup::init(), CelestiaCore::joystickAxis(), CelestiaCore::mouseButtonDown(), CelestiaCore::mouseMove(), SolveKeplerLaguerreConwayHyp::operator()(), SolveKeplerLaguerreConway::operator()(), operator/(), pfmod(), ProcessCometTailVertex(), renderAtmosphere(), Renderer::renderBodyAsParticle(), Renderer::renderCometTail(), Renderer::renderEllipsoidAtmosphere(), Galaxy::renderGalaxyPointSprites(), CelestiaCore::renderOverlay(), renderRingShadowsVS(), Quaternion< T >::slerp(), solve_iteration(), starOrbitStraddlesNodes(), starOrbitStraddlesNodesPredicate(), and syncMenusWithRendererState().

00048 {
00049     return (x < 0) ? -x : x;
00050 }

template<class T>
T circleArea r  ) 
 

Definition at line 93 of file mathlib.h.

References PI.

Referenced by Body::getLuminosity().

00094 {
00095     return (T) PI * r * r;
00096 }

template<class T>
T clamp x  ) 
 

Definition at line 62 of file mathlib.h.

Referenced by Color::Color(), StarRenderer::process(), Renderer::renderBodyAsParticle(), Renderer::renderEllipsoidAtmosphere(), Galaxy::renderGalaxyPointSprites(), Renderer::renderObject(), CelestiaCore::renderOverlay(), and Observer::update().

00063 {
00064     if (x < 0)
00065         return 0;
00066     else if (x > 1)
00067         return 1;
00068     else
00069         return x;
00070 }

template<class T>
T cube x  ) 
 

Definition at line 57 of file mathlib.h.

Referenced by IapetusOrbit::computePosition(), and StateVectorToOrbit().

00058 {
00059     return x * x * x;
00060 }

template<class T>
T degToRad d  ) 
 

Definition at line 37 of file mathlib.h.

References PI.

Referenced by Renderer::calcPixelSize(), computePlanetCoords(), JPLEphOrbit::computePosition(), TritonOrbit::computePosition(), UranianSatelliteOrbit::computePosition(), CallistoOrbit::computePosition(), GanymedeOrbit::computePosition(), EuropaOrbit::computePosition(), IoOrbit::computePosition(), DeimosOrbit::computePosition(), PhobosOrbit::computePosition(), PlutoOrbit::computePosition(), NeptuneOrbit::computePosition(), UranusOrbit::computePosition(), SaturnOrbit::computePosition(), JupiterOrbit::computePosition(), MarsOrbit::computePosition(), LunarOrbit::computePosition(), EarthOrbit::computePosition(), VenusOrbit::computePosition(), MercuryOrbit::computePosition(), cosD(), createEllipticalOrbit(), CreateEllipticalOrbit(), CreatePlanet(), createRotation(), DSORenderer::DSORenderer(), EpochConvert(), FillinRotationElements(), AssociativeArray::getRotation(), Url::goTo(), GotoObject(), GotoObjectProc(), CelestiaCore::initSimulation(), DeepSkyObject::load(), main(), meanAnomalySun(), Nutation(), Obliquity(), observer_setfov(), CommandParser::parseCommand(), Body::planetocentricToCartesian(), CommandSet::process(), Renderer::render(), Renderer::renderDeepSkyObjects(), Renderer::renderObject(), Renderer::renderStars(), SampledOrbit::sample(), SaturnMoonPosition(), sinD(), and LongLatDialog::slotApply().

00038 {
00039     return d / 180 * static_cast<T>(PI);
00040 }

template<class T>
T pfmod x,
y
 

Definition at line 84 of file mathlib.h.

References abs().

Referenced by auxJSun(), computePlanetCoords(), computePlanetElements(), CallistoOrbit::computePosition(), GanymedeOrbit::computePosition(), EuropaOrbit::computePosition(), IoOrbit::computePosition(), NeptuneOrbit::computePosition(), UranusOrbit::computePosition(), LunarOrbit::computePosition(), EarthOrbit::computePosition(), EclipticToEquatorial(), and Renderer::renderObject().

00085 {
00086     int quotient = (int) abs(x / y);
00087     if (x < 0.0)
00088         return x + (quotient + 1) * y;
00089     else
00090         return x - quotient * y;
00091 }

template<class T>
T radToDeg r  ) 
 

Definition at line 42 of file mathlib.h.

References PI.

Referenced by computePlanetCoords(), TitanOrbit::computePosition(), RheaOrbit::computePosition(), displayApparentDiameter(), displayLocationInfo(), Observer::getSelectionLongLat(), CelestiaCore::mouseMove(), OuterSaturnMoonParams(), Renderer::render(), CelestiaCore::renderOverlay(), showSelectionInfo(), StateVectorToOrbit(), and Url::Url().

00043 {
00044     return r * 180 / static_cast<T>(PI);
00045 }

template<class T>
T sign x  ) 
 

Definition at line 72 of file mathlib.h.

Referenced by BigFix::BigFix(), CelestiaCore::deleteView(), EllipticalOrbit::eccentricAnomaly(), CelestiaCore::joystickAxis(), celx::Scanner::nextToken(), Tokenizer::nextToken(), SolveKeplerLaguerreConwayHyp::operator()(), SolveKeplerLaguerreConway::operator()(), CelestiaCore::renderOverlay(), StarBrowserCompareFunc(), View::walkTreeResize(), and View::walkTreeResizeDelta().

00073 {
00074     if (x < 0)
00075         return -1;
00076     else if (x > 0)
00077         return 1;
00078     else
00079         return 0;
00080 }

template<class T>
T sphereArea r  ) 
 

Definition at line 98 of file mathlib.h.

References PI.

Referenced by Body::getLuminosity().

00099 {
00100     return 4 * (T) PI * r * r;
00101 }

template<class T>
T square x  ) 
 

Definition at line 52 of file mathlib.h.

Referenced by UranianSatelliteOrbit::computePosition(), IapetusOrbit::computePosition(), TitanOrbit::computePosition(), RheaOrbit::computePosition(), UniversalCoord::distanceTo(), ellipsePosition(), ellipsoidTangent(), Star::getRadius(), CelestiaCore::joystickAxis(), OuterSaturnMoonParams(), EllipticalOrbit::positionAtE(), ProcessCometTailVertex(), Renderer::render(), renderAtmosphere(), Renderer::renderCometTail(), Renderer::renderEllipsoidAtmosphere(), renderRings(), renderRings_GLSL(), StateVectorToOrbit(), and testIntersection().

00053 {
00054     return x * x;
00055 }


Generated on Sat Jan 14 22:32:45 2006 for Celestia by  doxygen 1.4.1