StelGeodesicGrid.hpp   StelGeodesicGrid.hpp 
/* /*
StelGeodesicGrid: a library for dividing the sphere into triangle zones StelGeodesicGrid: a library for dividing the sphere into triangle zones
by subdividing the icosahedron by subdividing the icosahedron
Author and Copyright: Johannes Gajdosik, 2006 Author and Copyright: Johannes Gajdosik, 2006
This library requires a simple Vector library, This library requires a simple Vector library,
which may have different copyright and license, which may have different copyright and license,
for example Vec3d from VecMath.hpp. for example Vec3f from VecMath.hpp.
In the moment I choose to distribute the library under the GPL, In the moment I choose to distribute the library under the GPL,
later I may choose to additionally distribute it under a more later I may choose to additionally distribute it under a more
relaxed license like the LGPL. If you want to have the library relaxed license like the LGPL. If you want to have the library
under another license, please ask me. under another license, please ask me.
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
skipping to change at line 58 skipping to change at line 58
StelGeodesicGrid(int maxLevel); StelGeodesicGrid(int maxLevel);
~StelGeodesicGrid(void); ~StelGeodesicGrid(void);
int getMaxLevel(void) const {return maxLevel;} int getMaxLevel(void) const {return maxLevel;}
static int nrOfZones(int level) {return (20<<(level<<1));} // 20*4^l evel static int nrOfZones(int level) {return (20<<(level<<1));} // 20*4^l evel
int getNrOfZones(void) const {return nrOfZones(maxLevel);} int getNrOfZones(void) const {return nrOfZones(maxLevel);}
typedef void (VisitFunc)(int lev,int index, typedef void (VisitFunc)(int lev,int index,
const Vec3d &c0, const Vec3f &c0,
const Vec3d &c1, const Vec3f &c1,
const Vec3d &c2, const Vec3f &c2,
void *context); void *context);
void visitTriangles(int maxVisitLevel, VisitFunc *func,void *context ) const; void visitTriangles(int maxVisitLevel, VisitFunc *func,void *context ) const;
//! Find the zone number in which a given point lies. //! Find the zone number in which a given point lies.
//! prerequisite: v*v==1 //! prerequisite: v*v==1
//! When the point lies on the border of two or more zones, //! When the point lies on the border of two or more zones,
//! one such zone is returned (always the same one, //! one such zone is returned (always the same one,
//! because the algorithm is deterministic). //! because the algorithm is deterministic).
int getZoneNumberForPoint(const Vec3d &v,int searchLevel) const; int getZoneNumberForPoint(const Vec3f &v,int searchLevel) const;
//! Return the position of the 3 corners for the triangle at the giv en level and index //! Return the position of the 3 corners for the triangle at the giv en level and index
void getTriangleCorners(int lev, int index, Vec3d& c0, Vec3d& c1, Ve c3d& c2) const; void getTriangleCorners(int lev, int index, Vec3f& c0, Vec3f& c1, Ve c3f& c2) const;
//! Return the index of the partner triangle with which to form a pa rallelogram //! Return the index of the partner triangle with which to form a pa rallelogram
int getPartnerTriangle(int lev, int index) const; int getPartnerTriangle(int lev, int index) const;
//! Return a search result matching the given spatial region //! 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 //! The result is cached, meaning that it is very fast to search the same region consecutively
//! @return a GeodesicSearchResult instance which must be used with GeodesicSearchBorderIterator and GeodesicSearchInsideIterator //! @return a GeodesicSearchResult instance which must be used with GeodesicSearchBorderIterator and GeodesicSearchInsideIterator
const GeodesicSearchResult* search(const QVector<SphericalCap>& conv ex, int maxSearchLevel) const; const GeodesicSearchResult* search(const QVector<SphericalCap>& conv ex, int maxSearchLevel) const;
private: private:
skipping to change at line 103 skipping to change at line 103
//! The array will be filled from the beginning with the inside zone numbers //! The array will be filled from the beginning with the inside zone numbers
//! and from the end with the border zone numbers of the given level l //! and from the end with the border zone numbers of the given level l
//! for 0<=l<=getMaxLevel(). //! for 0<=l<=getMaxLevel().
//! inside[l] will not contain zones that are already contained //! inside[l] will not contain zones that are already contained
//! in inside[l1] for some l1 < l. //! in inside[l1] for some l1 < l.
//! In order to restrict search depth set maxSearchLevel < maxLevel, //! In order to restrict search depth set maxSearchLevel < maxLevel,
//! for full search depth set maxSearchLevel = maxLevel, //! for full search depth set maxSearchLevel = maxLevel,
void searchZones(const QVector<SphericalCap>& convex, void searchZones(const QVector<SphericalCap>& convex,
int **inside,int **border,int maxSe archLevel) const; int **inside,int **border,int maxSe archLevel) const;
const Vec3d& getTriangleCorner(int lev, int index, int cornerNumber) const; const Vec3f& getTriangleCorner(int lev, int index, int cornerNumber) const;
void initTriangle(int lev,int index, void initTriangle(int lev,int index,
const Vec3d &c0, const Vec3f &c0,
const Vec3d &c1, const Vec3f &c1,
const Vec3d &c2); const Vec3f &c2);
void visitTriangles(int lev,int index, void visitTriangles(int lev,int index,
const Vec3d &c0, const Vec3f &c0,
const Vec3d &c1, const Vec3f &c1,
const Vec3d &c2, const Vec3f &c2,
int maxVisitLevel, int maxVisitLevel,
VisitFunc *func, VisitFunc *func,
void *context) const; void *context) const;
void searchZones(int lev,int index, void searchZones(int lev,int index,
const QVector<SphericalCap>& convex, const QVector<SphericalCap>& convex,
const int *indexOfUsedSphericalCaps, const int *indexOfUsedSphericalCaps,
const int halfSpacesUsed, const int halfSpacesUsed,
const bool *corner0_inside, const bool *corner0_inside,
const bool *corner1_inside, const bool *corner1_inside,
const bool *corner2_inside, const bool *corner2_inside,
int **inside,int **border,int maxSearchLevel) const ; int **inside,int **border,int maxSearchLevel) const ;
const int maxLevel; const int maxLevel;
struct Triangle struct Triangle
{ {
Vec3d e0,e1,e2; // Seitenmittelpunkte Vec3f e0,e1,e2; // Seitenmittelpunkte
}; };
Triangle **triangles; Triangle **triangles;
// 20*(4^0+4^1+...+4^n)=20*(4*(4^n)-1)/3 triangles total // 20*(4^0+4^1+...+4^n)=20*(4*(4^n)-1)/3 triangles total
// 2+10*4^n corners // 2+10*4^n corners
//! A cached search result used to avoid doing twice the same search //! A cached search result used to avoid doing twice the same search
mutable GeodesicSearchResult* cacheSearchResult; mutable GeodesicSearchResult* cacheSearchResult;
mutable int lastMaxSearchlevel; mutable int lastMaxSearchlevel;
mutable QVector<SphericalCap> lastSearchRegion; mutable QVector<SphericalCap> lastSearchRegion;
}; };
 End of changes. 8 change blocks. 
14 lines changed or deleted 14 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/