• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • kstars
  • htmesh
SpatialIndex.h
Go to the documentation of this file.
1 #ifndef _SpatialIndex_h
2 #define _SpatialIndex_h
3 
4 //# Filename: SpatialIndex.h
5 //#
6 //# SpatialIndex is the class for the sky indexing routines.
7 //#
8 //# Author: Peter Z. Kunszt, based on A. Szalay s code
9 //#
10 //# Date: October 15, 1998
11 //#
12 //# Copyright (C) 2000 Peter Z. Kunszt, Alex S. Szalay, Aniruddha R. Thakar
13 //# The Johns Hopkins University
14 //# Modification History:
15 //#
16 //# Oct 18, 2001 : Dennis C. Dinge -- Replaced ValVec with std::vector
17 //# Sept 9, 2002 : Gyorgy Fekete -- added setMaxlevel()
18 //#
19 
20 #include <cmath>
21 #include <string.h>
22 #include <time.h>
23 #include <SpatialGeneral.h>
24 #include <SpatialVector.h>
25 #include <SpatialEdge.h>
26 
27 #include <vector>
28 
29 
30 //########################################################################
31 //#
32 //# Spatial Index class
33 //#
34 
35 
59 class LINKAGE SpatialIndex {
60 public:
66  SpatialIndex(size_t maxlevel, size_t buildlevel =5);
67 
69  static uint64 idByName(const char *);
70 
80  static char * nameById(uint64 ID, char * name = 0);
81 
84  void pointById(SpatialVector & vector, uint64 ID) const;
85 
88  uint64 idByPoint(const SpatialVector & vector) const;
89 
91  void nodeVertex(const uint64 id,
92  SpatialVector & v1,
93  SpatialVector & v2,
94  SpatialVector & v3) const;
95 
96 private:
97 
98  // STRUCTURES
99 
100  struct Layer {
101  size_t level_; // layer level
102  size_t nVert_; // number of vertices in this layer
103  size_t nNode_; // number of nodes
104  size_t nEdge_; // number of edges
105  uint64 firstIndex_; // index of first node of this layer
106  size_t firstVertex_; // index of first vertex of this layer
107  };
108 
109  struct QuadNode {
110  uint64 index_; // its own index
111  size_t v_[3]; // The three vertex vector indices
112  size_t w_[3]; // The three middlepoint vector indices
113  uint64 childID_[4]; // ids of children
114  uint64 parent_; // id of the parent node (needed for sorting)
115  uint64 id_; // numeric id -> name
116  };
117 
118  // FUNCTIONS
119 
120  // insert a new node_[] into the list. The vertex indices are given by
121  // v1,v2,v3 and the id of the node is set.
122  uint64 newNode(size_t v1, size_t v2,size_t v3,uint64 id,uint64 parent);
123 
124  // make new nodes in a new layer.
125  void makeNewLayer(size_t oldlayer);
126 
127  // return the total number of nodes and vertices
128  void vMax(size_t *nodes, size_t *vertices);
129 
130  // sort the index so that the leaf nodes are at the beginning
131  void sortIndex();
132 
133  // Test whether a vector v is inside a triangle v0,v1,v2. Input
134  // triangle has to be sorted in a counter-clockwise direction.
135  bool isInside(const SpatialVector & v, const SpatialVector & v0,
136  const SpatialVector & v1, const SpatialVector & v2) const;
137 
138  // VARIABLES
139 
140  size_t maxlevel_; // the depth of the Layer
141  size_t buildlevel_; // the depth of the Layer stored
142  uint64 leaves_; // number of leaf nodes
143  uint64 storedleaves_; // number of stored leaf nodes
144  std::vector<QuadNode> nodes_; // the array of nodes
145  std::vector<Layer> layers_; // array of layers
146 
147  std::vector<SpatialVector> vertices_;
148  uint64 index_; // the current index_ of vertices
149 
150  friend class SpatialEdge;
151  friend class SpatialConvex;
152  friend class RangeConvex;
153 };
154 
155 #endif
SpatialIndex
The Spatial Index is a quad tree of spherical triangles.
Definition: SpatialIndex.h:59
SpatialVector.h
SpatialEdge.h
SpatialVector
The SpatialVector is a 3D vector usually living on the surface of the sphere.
Definition: SpatialVector.h:32
SpatialEdge
Definition: SpatialEdge.h:43
RangeConvex
A spatial convex is composed of spatial constraints.
Definition: RangeConvex.h:59
uint64
unsigned long long uint64
Definition: SpatialGeneral.h:69
SpatialGeneral.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:21 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal