SpatialIndex

Search for usage in LXR

#include <SpatialIndex.h>

Public Member Functions

 SpatialIndex (size_t maxlevel, size_t buildlevel=5)
 
uint64 idByPoint (const SpatialVector &vector) const
 
void nodeVertex (const uint64 id, SpatialVector &v1, SpatialVector &v2, SpatialVector &v3) const
 
void pointById (SpatialVector &vector, uint64 ID) const
 

Static Public Member Functions

static uint64 idByName (const char *)
 
static char * nameById (uint64 ID, char *name=nullptr)
 

Detailed Description

SpatialIndex 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 55 of file SpatialIndex.h.

Constructor & Destructor Documentation

◆ SpatialIndex()

SpatialIndex::SpatialIndex ( size_t maxlevel,
size_t buildlevel = 5 )

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 59 of file SpatialIndex.cpp.

Member Function Documentation

◆ idByName()

uint64 SpatialIndex::idByName ( const char * name)
static

NodeName conversion to integer ID.

Definition at line 341 of file SpatialIndex.cpp.

◆ idByPoint()

uint64 SpatialIndex::idByPoint ( const SpatialVector & vector) const

find a node by giving a vector.

The ID of the node is returned.

Definition at line 508 of file SpatialIndex.cpp.

◆ nameById()

char * SpatialIndex::nameById ( uint64 ID,
char * name = nullptr )
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 398 of file SpatialIndex.cpp.

◆ nodeVertex()

void SpatialIndex::nodeVertex ( const uint64 id,
SpatialVector & v1,
SpatialVector & v2,
SpatialVector & v3 ) const

return the actual vertex vectors

Definition at line 121 of file SpatialIndex.cpp.

◆ pointById()

void SpatialIndex::pointById ( SpatialVector & vector,
uint64 ID ) const

find the vector to the centroid of a triangle represented by the ID

Definition at line 457 of file SpatialIndex.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:53:02 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.