35 #ifndef _STELGEODESICGRID_HPP_ 36 #define _STELGEODESICGRID_HPP_ 53 int getMaxLevel(
void)
const {
return maxLevel;}
55 static int nrOfZones(
int level) {
return (20<<(level<<1));}
57 int getNrOfZones(
void)
const {
return nrOfZones(maxLevel);}
59 typedef void (VisitFunc)(
int lev,
int index,
64 void visitTriangles(
int maxVisitLevel, VisitFunc *func,
void *context)
const;
102 void searchZones(
const QVector<SphericalCap>& convex,
103 int **inside,
int **border,
int maxSearchLevel)
const;
105 const Vec3f& getTriangleCorner(
int lev,
int index,
int cornerNumber)
const;
106 void initTriangle(
int lev,
int index,
110 void visitTriangles(
int lev,
int index,
116 void *context)
const;
117 void searchZones(
int lev,
int index,
118 const QVector<SphericalCap>& convex,
119 const int *indexOfUsedSphericalCaps,
120 const int halfSpacesUsed,
121 const bool *corner0_inside,
122 const bool *corner1_inside,
123 const bool *corner2_inside,
124 int **inside,
int **border,
int maxSearchLevel)
const;
131 Triangle **triangles;
137 mutable int lastMaxSearchlevel;
138 mutable QVector<SphericalCap> lastSearchRegion;
146 void print(
void)
const;
152 void search(
const QVector<SphericalCap>& convex,
int maxSearchLevel);
164 : r(ar),level((alevel<0)?0:(alevel>ar.grid.getMaxLevel())
165 ?ar.grid.getMaxLevel():alevel),
166 end(ar.zones[GeodesicSearchBorderIterator::level]+
167 StelGeodesicGrid::nrOfZones(GeodesicSearchBorderIterator::level))
169 void reset(
void) {index = r.border[level];}
171 {
if (index < end) {
return *index++;}
return -1;}
175 const int *
const end;
185 maxLevel((alevel<0)?0:(alevel>ar.grid.getMaxLevel())?ar.grid.getMaxLevel():alevel)
200 #endif // _STELGEODESICGRID_HPP_ const GeodesicSearchResult * search(const QVector< SphericalCap > &convex, int maxSearchLevel) const
Return a search result matching the given spatial region The result is cached, meaning that it is ver...
int getZoneNumberForPoint(const Vec3f &v, int searchLevel) const
Find the zone number in which a given point lies.
Grid of triangles (zones) on the sphere with radius 1, generated by subdividing the icosahedron...
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.
Define all SphericalGeometry primitives as well as the SphericalRegionP type.