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