• 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
RangeConvex.h
Go to the documentation of this file.
1 #ifndef _RangeConvex_h
2 #define _RangeConvex_h
3 
4 //# Filename: RangeConvex.h
5 //#
6 //# Classes defined here: RangeConvex
7 //#
8 //#
9 //# Author: Peter Z. Kunszt, based on A. Szalay's code
10 //#
11 //# Date: October 16, 1998
12 //#
13 //# Copyright (C) 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 class RangeConvex;
22 class SpatialConstraint;
23 class SpatialSign;
24 
25 #include "SpatialConstraint.h"
26 #include "SpatialIndex.h"
27 #include "SpatialSign.h"
28 
29 #include <HtmRange.h>
30 
31 typedef std::vector<uint64> ValueVectorUint64;
32 
35 enum SpatialMarkup {
37  dONTKNOW,
39  pARTIAL,
41  fULL,
43  rEJECT
44 };
45 
46 
47 //########################################################################
48 //#
49 //# Spatial Convex class
50 //#
59 class LINKAGE RangeConvex {
60 public:
62  RangeConvex();
63 
65  RangeConvex(const SpatialVector * v1,
66  const SpatialVector * v2,
67  const SpatialVector * v3);
68 
70  RangeConvex(const SpatialVector * v1,
71  const SpatialVector * v2,
72  const SpatialVector * v3,
73  const SpatialVector * v4);
74 
76  void add(SpatialConstraint &);
77 
79  void simplify();
80 
82  void intersect(const SpatialIndex * index, HtmRange *hr);
83 
84  void setOlevel(int level) { olevel = level; };
85 
86 protected:
87  HtmRange *hr;
88  int olevel;
89  Sign sign_;
90 
91  // Do the intersection (common function for overloaded intersect())
92  // Simplification routine for zERO convexes. This is called by
93  // simplify() in case we have all zERO constraints.
94  void simplify0();
95 
96  // saveTrixel: saves the given htmid for later output
97  void saveTrixel(uint64 htmid);
98 
99  // testTrixel: Test the nodes of the index if the convex hits it
100  // the argument gives the index of the nodes_ array to specify the QuadNode
101  SpatialMarkup testTrixel(uint64 nodeIndex);
102 
103  // test each quadnode for intersections. Calls testTriangle after having
104  // tested the vertices using testVertex.
105  SpatialMarkup testNode(uint64 id);
106 
107  // SpatialMarkup testNode(const struct SpatialIndex::QuadNode *indexNode);
108  SpatialMarkup testNode(const SpatialVector & v0,
109  const SpatialVector & v1,
110  const SpatialVector & v2);
111 
112  // testTriangle: tests a triangle given by 3 vertices if
113  // it intersects the convex. Here the whole logic of deciding
114  // whether it is partial, full, swallowed or unknown is handled.
115  SpatialMarkup testTriangle(const SpatialVector & v0,
116  const SpatialVector & v1,
117  const SpatialVector & v2,
118  int vsum);
119 
120  // test a triangle's subtriangles whether they are partial.
121  // If level is nonzero, recurse: subdivide the
122  // triangle according to our rules and test each subdivision.
123  // (our rules are: each subdivided triangle has to be given
124  // ordered counter-clockwise, 0th index starts off new 0-node,
125  // 1st index starts off new 1-node, 2nd index starts off new 2-node
126  // middle triangle gives new 3-node.)
127  // if we are at the bottom, set this id's leafindex in partial bitlist.
128  void testPartial(size_t level, uint64 id,
129  const SpatialVector & v0,
130  const SpatialVector & v1,
131  const SpatialVector & v2, int previousPartials);
132 
133  // Test for constraint relative position; intersect, one in the
134  // other, disjoint.
135  int testConstraints(size_t i, size_t j);
136 
137  // Test if vertices are inside the convex for a node.
138  int testVertex(const SpatialVector & v);
139  int testVertex(const SpatialVector *v);
140 
141  // testHole : look for 'holes', i.e. negative constraints that have their
142  // centers inside the node with the three corners v0,v1,v2.
143  bool testHole(const SpatialVector & v0,
144  const SpatialVector & v1,
145  const SpatialVector & v2);
146 
147  // testEdge0: test the edges of the triangle against the edges of the
148  // zERO convex. The convex is stored in corners_ so that the convex
149  // is always on the left-hand-side of an edge corners_(i) - corners_(i+1).
150  // (just like the triangles). This makes testing for intersections with
151  // the edges easy.
152  bool testEdge0(const SpatialVector & v0,
153  const SpatialVector & v1,
154  const SpatialVector & v2);
155 
156  // testEdge: look whether one of the constraints intersects with one of
157  // the edges of node with the corners v0,v1,v2.
158  bool testEdge(const SpatialVector & v0,
159  const SpatialVector & v1,
160  const SpatialVector & v2);
161 
162  // eSolve: solve the quadratic equation for the edge v1,v2 of
163  // constraint[cIndex]
164  bool eSolve(const SpatialVector & v1,
165  const SpatialVector & v2, size_t cIndex);
166 
167  // Test if bounding circle intersects with a constraint
168  bool testBoundingCircle(const SpatialVector & v0,
169  const SpatialVector & v1,
170  const SpatialVector & v2);
171 
172  // Test if a constraint intersects the edges
173  bool testEdgeConstraint(const SpatialVector & v0,
174  const SpatialVector & v1,
175  const SpatialVector & v2,
176  size_t cIndex);
177 
178  // Look for any positive constraint that does not intersect the edges
179  size_t testOtherPosNone(const SpatialVector & v0,
180  const SpatialVector & v1,
181  const SpatialVector & v2);
182 
183  // Test for a constraint lying inside or outside of triangle
184  bool testConstraintInside(const SpatialVector & v0,
185  const SpatialVector & v1,
186  const SpatialVector & v2,
187  size_t cIndex);
188 
189  // Test for a vector lying inside or outside of triangle
190  bool testVectorInside(const SpatialVector & v0,
191  const SpatialVector & v1,
192  const SpatialVector & v2,
193  SpatialVector & v);
194 
195  std::vector<SpatialConstraint> constraints_; // The vector of constraints
196  const SpatialIndex * index_; // A pointer to the index
197  std::vector<SpatialVector> corners_;
198  SpatialConstraint boundingCircle_; // For zERO convexes, the bc.
199  size_t addlevel_; // additional levels to calculate
200  ValueVectorUint64 * plist_; // list of partial node ids
201 private:
202  // Disallow copying and assignemnt
203  RangeConvex(const RangeConvex &);
204  RangeConvex& operator =(const RangeConvex &);
205 };
206 
207 #endif
RangeConvex::olevel
int olevel
Definition: RangeConvex.h:88
SpatialIndex
The Spatial Index is a quad tree of spherical triangles.
Definition: SpatialIndex.h:59
RangeConvex::index_
const SpatialIndex * index_
Definition: RangeConvex.h:196
SpatialMarkup
SpatialMarkup
Enumerator.
Definition: RangeConvex.h:35
RangeConvex::boundingCircle_
SpatialConstraint boundingCircle_
Definition: RangeConvex.h:198
pARTIAL
Triangle partially intersected.
Definition: RangeConvex.h:39
rEJECT
Triangle is outside the queried area.
Definition: RangeConvex.h:43
SpatialSign.h
HtmRange.h
SpatialConstraint
The Constraint is really a cone on the sky-sphere.
Definition: SpatialConstraint.h:76
RangeConvex::addlevel_
size_t addlevel_
Definition: RangeConvex.h:199
RangeConvex::corners_
std::vector< SpatialVector > corners_
Definition: RangeConvex.h:197
Sign
Sign
Definition: SpatialSign.h:8
SpatialVector
The SpatialVector is a 3D vector usually living on the surface of the sphere.
Definition: SpatialVector.h:32
SpatialIndex.h
HtmRange
Definition: HtmRange.h:14
fULL
All of the triangle is inside queried area.
Definition: RangeConvex.h:41
RangeConvex::constraints_
std::vector< SpatialConstraint > constraints_
Definition: RangeConvex.h:195
RangeConvex
A spatial convex is composed of spatial constraints.
Definition: RangeConvex.h:59
SpatialConstraint.h
uint64
unsigned long long uint64
Definition: SpatialGeneral.h:69
RangeConvex::setOlevel
void setOlevel(int level)
Definition: RangeConvex.h:84
ValueVectorUint64
std::vector< uint64 > ValueVectorUint64
Definition: RangeConvex.h:23
dONTKNOW
Uncertain.
Definition: RangeConvex.h:37
RangeConvex::sign_
Sign sign_
Definition: RangeConvex.h:89
RangeConvex::plist_
ValueVectorUint64 * plist_
Definition: RangeConvex.h:200
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:20 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