17#include "SpatialEdge.h"
24#define IV(x) tree_.nodes_[index].v_[(x)]
25#define IW(x) tree_.nodes_[index].w_[(x)]
26#define LAYER tree_.layers_[layerindex_]
36SpatialEdge::SpatialEdge(
SpatialIndex &tree,
size_t layerindex) : tree_(tree), layerindex_(layerindex)
38 edges_ =
new Edge[LAYER.nEdge_ + 1];
39 lTab_ =
new Edge *[LAYER.nVert_ * 6];
42 for (
size_t i = 0; i < LAYER.nVert_ * 6; i++)
46 index_ = LAYER.nVert_;
51SpatialEdge::~SpatialEdge()
60void SpatialEdge::makeMidPoints()
67 index = (size_t)LAYER.firstIndex_;
68 for (
size_t i = 0; i < LAYER.nNode_; i++, index++)
70 c = newEdge(c, index, 0);
71 c = newEdge(c, index, 1);
72 c = newEdge(c, index, 2);
82size_t SpatialEdge::newEdge(
size_t emindex,
size_t index,
int k)
87 em = &edges_[emindex];
107 if (em->start_ > em->end_)
110 em->start_ = em->end_;
117 if ((en = edgeMatch(em)) !=
nullptr)
127 IW(k) = getMidPoint(em);
137void SpatialEdge::insertLookup(Edge *em)
139 int j = 6 * em->start_;
144 for (i = 0; i < 6; i++, j++)
146 if (lTab_[j] ==
nullptr)
157SpatialEdge::Edge *SpatialEdge::edgeMatch(Edge *em)
159 int i = 6 * em->start_;
161 while (lTab_[i] !=
nullptr)
163 if (em->end_ == lTab_[i]->end_)
174size_t SpatialEdge::getMidPoint(Edge *em)
176 tree_.vertices_[index_] = tree_.vertices_[em->start_] + tree_.vertices_[em->end_];
177 tree_.vertices_[index_].normalize();
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 Sat Dec 21 2024 17:04:46 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.