Stellarium  0.90.0
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Friends
StelGeodesicGrid Class Reference

Grid of triangles (zones) on the sphere with radius 1, generated by subdividing the icosahedron. More...

#include <StelGeodesicGrid.hpp>

Public Types

typedef void( VisitFunc) (int lev, int index, const Vec3f &c0, const Vec3f &c1, const Vec3f &c2, void *context)
 

Public Member Functions

 StelGeodesicGrid (int maxLevel)
 
int getMaxLevel (void) const
 
int getNrOfZones (void) const
 
void visitTriangles (int maxVisitLevel, VisitFunc *func, void *context) const
 
int getZoneNumberForPoint (const Vec3f &v, int searchLevel) const
 Find the zone number in which a given point lies. More...
 
void getTriangleCorners (int lev, int index, Vec3f &c0, Vec3f &c1, Vec3f &c2) const
 Return the position of the 3 corners for the triangle at the given level and index.
 
int getPartnerTriangle (int lev, int index) const
 Return the index of the partner triangle with which to form a parallelogram.
 
const GeodesicSearchResultsearch (const QVector< SphericalCap > &convex, int maxSearchLevel) const
 Return a search result matching the given spatial region The result is cached, meaning that it is very fast to search the same region consecutively. More...
 

Static Public Member Functions

static int nrOfZones (int level)
 

Friends

class GeodesicSearchResult
 

Detailed Description

level 0: just the icosahedron, 20 zones level 1: 80 zones, level 2: 320 zones, ... Each zone has a unique integer number in the range [0,getNrOfZones()-1].

Member Function Documentation

int StelGeodesicGrid::getZoneNumberForPoint ( const Vec3f v,
int  searchLevel 
) const

prerequisite: v*v==1 When the point lies on the border of two or more zones, one such zone is returned (always the same one, because the algorithm is deterministic).

const GeodesicSearchResult* StelGeodesicGrid::search ( const QVector< SphericalCap > &  convex,
int  maxSearchLevel 
) const