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

MixedOrbit Class Reference

#include <orbit.h>

Inheritance diagram for MixedOrbit:

Inheritance graph
Collaboration diagram for MixedOrbit:

Collaboration graph
List of all members.

Public Member Functions

virtual double getBoundingRadius () const
virtual double getPeriod () const
 MixedOrbit (Orbit *orbit, double t0, double t1, double mass)
Point3d positionAtTime (double jd) const
virtual void sample (double, double, int, OrbitSampleProc &proc) const
virtual ~MixedOrbit ()

Private Attributes

EllipticalOrbitafterApprox
EllipticalOrbitbeforeApprox
double begin
double boundingRadius
double end
Orbitprimary

Detailed Description

A mixed orbit is a composite orbit, typically used when you have a custom orbit calculation that is only valid over limited span of time. When a mixed orbit is constructed, it computes elliptical orbits to approximate the behavior of the primary orbit before and after the span over which it is valid.

Definition at line 101 of file orbit.h.


Constructor & Destructor Documentation

MixedOrbit::MixedOrbit Orbit orbit,
double  t0,
double  t1,
double  mass
 

Definition at line 320 of file orbit.cpp.

References afterApprox, beforeApprox, boundingRadius, Orbit::getBoundingRadius(), EllipticalOrbit::getBoundingRadius(), primary, and StateVectorToOrbit().

00320                                                                       :
00321     primary(orbit),
00322     afterApprox(NULL),
00323     beforeApprox(NULL),
00324     begin(t0),
00325     end(t1),
00326     boundingRadius(0.0)
00327 {
00328     assert(t1 > t0);
00329     assert(orbit != NULL);
00330     
00331     double dt = 1.0 / 1440.0; // 1 minute
00332     Point3d p0 = orbit->positionAtTime(t0);
00333     Point3d p1 = orbit->positionAtTime(t1);
00334     Vec3d v0 = (orbit->positionAtTime(t0 + dt) - p0) / (86400 * dt);
00335     Vec3d v1 = (orbit->positionAtTime(t1 + dt) - p1) / (86400 * dt);
00336     beforeApprox = StateVectorToOrbit(p0, v0, mass, t0);
00337     afterApprox = StateVectorToOrbit(p1, v1, mass, t1);
00338 
00339     boundingRadius = beforeApprox->getBoundingRadius();
00340     if (primary->getBoundingRadius() > boundingRadius)
00341         boundingRadius = primary->getBoundingRadius();
00342     if (afterApprox->getBoundingRadius() > boundingRadius)
00343         boundingRadius = afterApprox->getBoundingRadius();
00344 }

MixedOrbit::~MixedOrbit  )  [virtual]
 

Definition at line 346 of file orbit.cpp.

References afterApprox, beforeApprox, and primary.

00347 {
00348     if (primary != NULL)
00349         delete primary;
00350     if (beforeApprox != NULL)
00351         delete beforeApprox;
00352     if (afterApprox != NULL)
00353         delete afterApprox;
00354 }


Member Function Documentation

double MixedOrbit::getBoundingRadius  )  const [virtual]
 

Implements Orbit.

Definition at line 374 of file orbit.cpp.

References boundingRadius.

00375 {
00376     return boundingRadius;
00377 }

double MixedOrbit::getPeriod  )  const [virtual]
 

Implements Orbit.

Definition at line 368 of file orbit.cpp.

References Orbit::getPeriod(), and primary.

00369 {
00370     return primary->getPeriod();
00371 }

Point3d MixedOrbit::positionAtTime double  jd  )  const [virtual]
 

Implements Orbit.

Definition at line 357 of file orbit.cpp.

References afterApprox, beforeApprox, begin, end, Orbit::positionAtTime(), EllipticalOrbit::positionAtTime(), and primary.

00358 {
00359     if (jd < begin)
00360         return beforeApprox->positionAtTime(jd);
00361     else if (jd < end)
00362         return primary->positionAtTime(jd);
00363     else
00364         return afterApprox->positionAtTime(jd);
00365 }

void MixedOrbit::sample double  ,
double  ,
int  ,
OrbitSampleProc proc
const [virtual]
 

Implements Orbit.

Definition at line 380 of file orbit.cpp.

References afterApprox, beforeApprox, begin, end, primary, and Orbit::sample().

00382 {
00383     Orbit* o;
00384     if (t0 < begin)
00385         o = beforeApprox;
00386     else if (t0 < end)
00387         o = primary;
00388     else
00389         o = afterApprox;
00390     o->sample(t0, t1, nSamples, proc);
00391 }


Member Data Documentation

EllipticalOrbit* MixedOrbit::afterApprox [private]
 

Definition at line 114 of file orbit.h.

Referenced by MixedOrbit(), positionAtTime(), sample(), and ~MixedOrbit().

EllipticalOrbit* MixedOrbit::beforeApprox [private]
 

Definition at line 115 of file orbit.h.

Referenced by MixedOrbit(), positionAtTime(), sample(), and ~MixedOrbit().

double MixedOrbit::begin [private]
 

Definition at line 116 of file orbit.h.

Referenced by positionAtTime(), and sample().

double MixedOrbit::boundingRadius [private]
 

Definition at line 118 of file orbit.h.

Referenced by getBoundingRadius(), and MixedOrbit().

double MixedOrbit::end [private]
 

Definition at line 117 of file orbit.h.

Referenced by positionAtTime(), and sample().

Orbit* MixedOrbit::primary [private]
 

Definition at line 113 of file orbit.h.

Referenced by getPeriod(), MixedOrbit(), positionAtTime(), sample(), and ~MixedOrbit().


The documentation for this class was generated from the following files:
Generated on Sat Jan 14 22:33:28 2006 for Celestia by  doxygen 1.4.1