Kstars

SpatialEdge.h
1#ifndef _SpatialEdge_h
2#define _SpatialEdge_h
3
4//# Filename: SpatialEdge.h
5//#
6//# SpatialEdge is a helper class for the spatial index at construction
7//# time.
8//#
9//# Author: Peter Z. Kunszt, based on A. Szalay's code
10//#
11//# Date: October 15, 1998
12//#
13//# SPDX-FileCopyrightText: 2000 Peter Z. Kunszt Alex S. Szalay, Aniruddha R. Thakar
14//# The Johns Hopkins University
15//#
16//# Modification History:
17//#
18//# Oct 18, 2001 : Dennis C. Dinge -- Replaced ValVec with std::vector
19//#
20
21#include "SpatialIndex.h"
22
23// Forward declarations
24class SpatialIndex;
25
26//########################################################################
27//
28// <GROUP>
29// <SUMMARY>Class declarations</SUMMARY>
30//
31
32//########################################################################
33//
34// <SUMMARY> Spatial Edge class </SUMMARY>
35//
36// The Edges are needed at construction time of the spatial index.
37// They are used to generate the midpoints of the nodes in a certain layer.
38// The interface is simple: construct a class giving it the SpatialIndex
39// and the layer number. Then call makeMidPoints. The SpatialIndex will
40// then have its midpoint constructed in every QuadNode.
41
42class LINKAGE SpatialEdge
43{
44 public:
45 // Constructor : give the tree and its layer
46 SpatialEdge(SpatialIndex &tree, size_t layerindex);
47
48 // Destructor
49 ~SpatialEdge();
50
51 // Interface to class: generate midpoints.
52 void makeMidPoints();
53
54 private:
55 struct Edge
56 {
57 size_t start_; // starting vertex index of edge
58 size_t end_; // index of end
59 size_t mid_; // index of center
60 };
61
62 // Make a new edge, in the temporary edges_ at emindex, at node_[index]
63 // using the k'th side. Since every edge belongs to two faces, we have]
64 // to check whether an edge has been already processed or not (i.e. the
65 // midpoint has been constructed or not). We have a lookup table for
66 // this purpose. Every edge is stored at lTab[start_]. There may be
67 // up to 6 edges in every vertex[start_] so if that table place is occupied,
68 // store it in the next table position (and so on). So we only have to
69 // look up 6 positions at most.
70 size_t newEdge(size_t emindex, size_t index, int k);
71
72 // insert the edge em into the lookup table
73 void insertLookup(Edge *em);
74
75 // lookup the edge em in the lookup table
76 Edge *edgeMatch(Edge *em);
77
78 // generate a new vertex, which is the midpoint of the current edge.
79 size_t getMidPoint(Edge *em);
80
81 SpatialIndex &tree_; // reference to the tree class
82 size_t layerindex_; // index of the layer
83 Edge **lTab_; // Edges lookup table
84 Edge *edges_; // Edges array
85 size_t index_; // index of the vertex that is built
86};
87
88// </GROUP>
89//
90
91#endif
SpatialIndex is a quad tree of spherical triangles.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:59:52 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.