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

octree.cpp File Reference

#include <cmath>
#include "astro.h"
#include "octree.h"

Include dependency graph for octree.cpp:

Go to the source code of this file.

Enumerations

enum  { XPos = 1, YPos = 2, ZPos = 4 }

Functions

static int childIndex (const Star &star, const Point3f &center)
bool starOrbitStraddlesNodes (const Star &star, const Point3f &center)

Variables

static const unsigned int splitThreshold = 100
static const float sqrt3 = 1.732050808f


Enumeration Type Documentation

anonymous enum
 

Enumeration values:
XPos 
YPos 
ZPos 

Definition at line 33 of file octree.cpp.

00034 {
00035     XPos = 1,
00036     YPos = 2,
00037     ZPos = 4,
00038 };


Function Documentation

static int childIndex const Star star,
const Point3f center
[static]
 

Definition at line 69 of file octree.cpp.

References Point3< T >::x, XPos, Point3< T >::y, YPos, Point3< T >::z, and ZPos.

00070 {
00071     Point3f pos = star.getPosition();
00072 
00073     int child = 0;
00074     child |= pos.x < center.x ? 0 : XPos;
00075     child |= pos.y < center.y ? 0 : YPos;
00076     child |= pos.z < center.z ? 0 : ZPos;
00077     
00078     return child;
00079 }

bool starOrbitStraddlesNodes const Star star,
const Point3f center
[inline]
 

Definition at line 83 of file octree.cpp.

References abs(), Point3< T >::x, Point3< T >::y, and Point3< T >::z.

00084 {
00085     float orbitalRadius = star.getOrbitalRadius();
00086     if (orbitalRadius == 0.0f)
00087         return false;
00088 
00089     Point3f starPos = star.getPosition();
00090     return (abs(starPos.x - center.x) < orbitalRadius ||
00091             abs(starPos.y - center.y) < orbitalRadius ||
00092             abs(starPos.z - center.z) < orbitalRadius);
00093 }


Variable Documentation

const unsigned int splitThreshold = 100 [static]
 

Definition at line 46 of file octree.cpp.

const float sqrt3 = 1.732050808f [static]
 

Definition at line 48 of file octree.cpp.


Generated on Sat Jan 14 22:31:02 2006 for Celestia by  doxygen 1.4.1