kstars
SpatialIndex Class Reference
The Spatial Index is a quad tree of spherical triangles. More...
#include <SpatialIndex.h>
Public Member Functions | |
| float64 | area (const SpatialVector &v1, const SpatialVector &v2, const SpatialVector &v3) const |
| float64 | area (uint64 ID) const |
| size_t | getBildLevel () |
| size_t | getMaxlevel () |
| uint64 | idByLeafNumber (uint32 n) const |
| uint64 | idByPoint (const float64 &ra, const float64 &dec) const |
| uint64 | idByPoint (SpatialVector &vector) const |
| uint64 | leafCount () const |
| uint32 | leafNumberById (uint64 ID) const |
| char * | nameByLeafNumber (uint32 n, char *name=0) const |
| char * | nameByPoint (const float64 &ra, const float64 &dec, char *s=NULL) const |
| char * | nameByPoint (SpatialVector &vector, char *s=NULL) const |
| void | nodeVertex (const size_t idx, size_t &v1, size_t &v2, size_t &v3) const |
| void | nodeVertex (const uint64 id, SpatialVector &v1, SpatialVector &v2, SpatialVector &v3) const |
| size_t | nVertices () const |
| void | pointById (SpatialVector &vector, uint64 ID) const |
| void | setMaxlevel (int level) |
| void | showVertices (std::ostream &out) const |
| SpatialIndex (size_t maxlevel, size_t buildlevel=5) | |
| SpatialIndex () | |
Static Public Member Functions | |
| static uint64 | idByName (const char *) |
| static char * | nameById (uint64 ID, char *name=0) |
Detailed Description
The Spatial Index is a quad tree of spherical triangles.The tree is built in the following way: Start out with 8 triangles on the sphere using the 3 main circles to determine them. Then, every triangle can be decomposed into 4 new triangles by drawing main circles between midpoints of its edges:
. /\ . / \ . /____\ . /\ /\ . / \ / \ . /____\/____\
This is how the quad tree is built up to a certain level by decomposing every triangle again and again.
Definition at line 63 of file SpatialIndex.h.
Constructor & Destructor Documentation
| SpatialIndex::SpatialIndex | ( | ) | [inline] |
Constructor.
Give the level of the index and optionally the level to build - i.e. the depth to keep in memory. if maxlevel - buildlevel > 0 , that many levels are generated on the fly each time the index is called.
Definition at line 73 of file SpatialIndex.h.
| SpatialIndex::SpatialIndex | ( | size_t | maxlevel, | |
| size_t | buildlevel = 5 | |||
| ) |
Definition at line 59 of file SpatialIndex.cpp.
Member Function Documentation
| float64 SpatialIndex::area | ( | const SpatialVector & | v1, | |
| const SpatialVector & | v2, | |||
| const SpatialVector & | v3 | |||
| ) | const |
The area in steradians for a given spatial triangle.
Definition at line 276 of file SpatialIndex.cpp.
| size_t SpatialIndex::getBildLevel | ( | ) | [inline] |
Definition at line 66 of file SpatialIndex.h.
| size_t SpatialIndex::getMaxlevel | ( | ) | [inline] |
Definition at line 65 of file SpatialIndex.h.
Return leaf id for a certain bitlist index.
Same as the function above
| uint64 SpatialIndex::idByName | ( | const char * | name | ) | [static] |
find a node by giving a ra,dec in degrees.
| uint64 SpatialIndex::idByPoint | ( | SpatialVector & | vector | ) | const |
find a node by giving a vector.
The ID of the node is returned.
Definition at line 561 of file SpatialIndex.cpp.
| uint64 SpatialIndex::leafCount | ( | ) | const |
return number of leaf nodes
Return leaf number in bitlist for a certain ID.
Since the ID here means the number computed from the name, this is simply returning ID -leafCount(). Bitlists only work until level 14.
| char * SpatialIndex::nameById | ( | uint64 | ID, | |
| char * | name = 0 | |||
| ) | [static] |
int32 conversion to a string (name of database).
WARNING: if name is already allocated, a size of at least 17 is required. The conversion is done by directly calculating the name from a number. To calculate the name of a certain level, the mechanism is that the name is given by (of nodes in that level) + (id of node). So for example, for the first level, there are 8 nodes, and we get the names from numbers 8 through 15 giving S0,S1,S2,S3,N0,N1,N2,N3. The order is always ascending starting from S0000.. to N3333...
Definition at line 454 of file SpatialIndex.cpp.
| char* SpatialIndex::nameByLeafNumber | ( | uint32 | n, | |
| char * | name = 0 | |||
| ) | const |
return name for a certain leaf index (to be used for name lookup from a bitlist).
This function is simply shorthand for nameById(n + leafCount()).
find a node by giving a ra,dec in degrees.
| char* SpatialIndex::nameByPoint | ( | SpatialVector & | vector, | |
| char * | s = NULL | |||
| ) | const |
find a node by giving a vector.
- Returns:
- The ID of the node is returned.
| void SpatialIndex::nodeVertex | ( | const size_t | idx, | |
| size_t & | v1, | |||
| size_t & | v2, | |||
| size_t & | v3 | |||
| ) | const |
| void SpatialIndex::nodeVertex | ( | const uint64 | id, | |
| SpatialVector & | v1, | |||
| SpatialVector & | v2, | |||
| SpatialVector & | v3 | |||
| ) | const |
| size_t SpatialIndex::nVertices | ( | ) | const |
return number of vertices
| void SpatialIndex::pointById | ( | SpatialVector & | vector, | |
| uint64 | ID | |||
| ) | const |
find the vector to the centroid of a triangle represented by the ID
Definition at line 509 of file SpatialIndex.cpp.
| void SpatialIndex::setMaxlevel | ( | int | level | ) |
set the maximum depth of the layer
| void SpatialIndex::showVertices | ( | std::ostream & | out | ) | const |
The documentation for this class was generated from the following files:
KDE 4.2 API Reference