HTM SpatialIndex Class Reference

class SpatialIndex

The Spatial Index is a quad tree of spherical triangles

Public Methods

SpatialIndex (size_t maxlevel, size_t buildlevel =2)
Constructor
static uint64 idByName (const char *)
NodeName conversion to integer ID
static char* nameById (uint64 ID, char * name = 0)
int32 conversion to a string (name of database)
uint32 leafNumberById (uint64 ID) const
Return leaf number in bitlist for a certain ID
uint64 idByLeafNumber (uint32 n) const
Return leaf id for a certain bitlist index
char* nameByLeafNumber (uint32 n, char * name = 0) const
return name for a certain leaf index (to be used for name lookup from a bitlist)
uint64 idByPoint (SpatialVector & vector) const
find a node by giving a vector
uint64 idByPoint (const float64 & ra, const float64 & dec) const
find a node by giving a ra,dec in degrees.
char* nameByPoint (SpatialVector & vector, char* s=NULL) const
char* nameByPoint (const float64 & ra, const float64 & dec, char* s=NULL) const
find a node by giving a ra,dec in degrees.
uint64 leafCount () const
return number of leaf nodes
size_t nVertices () const
return number of vertices
float64 area (uint64 ID) const
The area in steradians for a given index ID
float64 area (const SpatialVector & v1, const SpatialVector & v2, const SpatialVector & v3) const
The area in steradians for a given spatial triangle
void nodeVertex (const uint64 id, SpatialVector & v1, SpatialVector & v2, SpatialVector & v3) const
return the actual vertex vectors
void nodeVertex (const size_t idx, size_t & v1, size_t & v2, size_t & v3) const
return index of vertices for a node
void showVertices (ostream & out) const
print all vertices to output stream

Public


find a node by giving a vector.

Documentation

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.
SpatialIndex(size_t maxlevel, size_t buildlevel =2)
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.

static uint64 idByName(const char *)
NodeName conversion to integer ID

static char* nameById(uint64 ID, char * name = 0)
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...

uint32 leafNumberById(uint64 ID) const
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.

uint64 idByLeafNumber(uint32 n) const
Return leaf id for a certain bitlist index. Same as the function above

char* 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()).

uint64 idByPoint(SpatialVector & vector) const
find a node by giving a vector. The ID of the node is returned.

uint64 idByPoint(const float64 & ra, const float64 & dec) const
find a node by giving a ra,dec in degrees.

find a node by giving a vector.

char* nameByPoint(SpatialVector & vector, char* s=NULL) const
Returns:
The ID of the node is returned.

char* nameByPoint(const float64 & ra, const float64 & dec, char* s=NULL) const
find a node by giving a ra,dec in degrees.

uint64 leafCount() const
return number of leaf nodes

size_t nVertices() const
return number of vertices

float64 area(uint64 ID) const
The area in steradians for a given index ID

float64 area(const SpatialVector & v1, const SpatialVector & v2, const SpatialVector & v3) const
The area in steradians for a given spatial triangle

void nodeVertex(const uint64 id, SpatialVector & v1, SpatialVector & v2, SpatialVector & v3) const
return the actual vertex vectors

void nodeVertex(const size_t idx, size_t & v1, size_t & v2, size_t & v3) const
return index of vertices for a node

void showVertices(ostream & out) const
print all vertices to output stream

size_t level_

size_t nVert_
layer level

size_t nNode_
number of vertices in this layer

size_t nEdge_
number of nodes

uint64 firstIndex_
number of edges

size_t firstVertex_
index of first node of this layer

index of first vertex of this layer

uint64 index_

size_t v_[3]
its own index

size_t w_[3]
The three vertex vector indices

uint64 childID_[4]
The three middlepoint vector indices

uint64 parent_
ids of children

uint64 id_
id of the parent node (needed for sorting)


This class has no child classes.

alphabetic index hierarchy of classes


© Copyright The Johns Hopkins University 1999, All Rights Reserved.
Peter Z. Kunszt,

generated by doc++