cheshirekow  v0.1.0
Triangulation.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Josh Bialkowski (jbialk@mit.edu)
3  *
4  * This file is part of mpblocks.
5  *
6  * mpblocks is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * mpblocks is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with mpblocks. If not, see <http://www.gnu.org/licenses/>.
18  */
27 #ifndef MPBLOCKS_CLARKSON93_DYNAMIC_TRIANGULATION_H_
28 #define MPBLOCKS_CLARKSON93_DYNAMIC_TRIANGULATION_H_
29 
30 #include <mpblocks/clarkson93.h>
31 #include <set>
32 #include <queue>
33 
34 
35 namespace mpblocks {
36 namespace clarkson93 {
37 namespace dynamic {
38 
39 
42 
52 template < class Traits >
54 {
55  public:
56  // Typedefs
57  // -----------------------------------------------------------------------
58  static const unsigned int NDim = Traits::NDim;
59 
60  typedef unsigned int uint;
61  typedef typename Traits::Scalar Scalar;
62  typedef typename Traits::Point Point;
63  typedef typename Traits::Simplex Simplex;
64  typedef typename Traits::PointRef PointRef;
65  typedef typename Traits::PointDeref PointDeref;
66  typedef typename Traits::Setup Setup;
67 
70 
73 
77 
78  typedef typename Traits::template Factory<Simplex> SimplexAlloc;
79  typedef typename Traits::template Factory<HorizonRidge_t> HorizonAlloc;
80  typedef std::set<PointRef> PointSet;
81 
82  // priority queue stuff
85 
86  public:
87  // Data Members
88  // -----------------------------------------------------------------------
94 
97 
101 
104 
106 
107  public:
108  Triangulation();
109  ~Triangulation();
110 
113  void setup( Setup& setup );
114 
117  template <class Iterator>
118  void init(Iterator begin, Iterator end);
119 
122 
126  void insert(const PointRef x, Simplex* S=0);
127 
130  void clear();
131 
134 
137 
145  void find_x_visible(PointRef x, Simplex* S=0);
146 
147  // update each x-visible simplex by adding the point x as the peak
148  // vertex, also create new simplices
149  void alter_x_visible(PointRef x);
150 };
151 
152 
153 
154 } // namespace dynamic
155 } // namespace clarkson93
156 } // namespace mpblocks
157 
158 
159 
160 
161 
162 
163 
164 
165 
166 
167 
168 
169 
170 
171 #endif // TRIANGULATION_H_
Traits::template Factory< Simplex > SimplexAlloc
Definition: Triangulation.h:78
priority queue node
Definition: Indexed.h:38
void insert(const PointRef x, Simplex *S=0)
insert a new point into the triangulation and update the convex hull (if necessary) ...
WalkQueue m_xv_walk
walk for x-visible search
Definition: Triangulation.h:95
SimplexSet m_x_visible
set of x-visible simplices
Definition: Triangulation.h:99
Traits::template Factory< HorizonRidge_t > HorizonAlloc
Definition: Triangulation.h:79
A simplex is the convex hull of d+1 points in general position (IGP), i.e. they do not lie on the sam...
Definition: Simplex.h:79
SimplexSet m_xv_queue
search queue for x-visible building
Indexed< Scalar, Simplex * > PQ_Key
Definition: Triangulation.h:83
void find_x_visible(PointRef x, Simplex *S=0)
find the set of facets and put them in x_visible
SimplexAlloc & getAllocator()
return the allocator (for debugging)
PointDeref m_deref
dereferences a PointRef
Definition: Triangulation.h:93
void init(Iterator begin, Iterator end)
builds the initial triangulation from the first NDim + 1 points inserted
SimplexSet m_xv_walked
set of simplices ever expanded for the walk
Definition: Triangulation.h:96
void setup(Setup &setup)
set's up the triangulation by helping it construct it's allocators and preallocate it's sets ...
Simplex * m_hullSimplex
a simplex in the hull
Definition: Triangulation.h:90
HorizonSet m_ridges
set of horizon ridges
Stack< Simplex *, SimplexBits > SimplexSet
Definition: Triangulation.h:74
A horizon ridge is a d-2 dimensional facet (i.e. a facet of a facet),.
Definition: HorizonRidge.h:39
SimplexAlloc m_sAlloc
simplex allocator
misleadingly-named data structure, is actually a "simplexification", the dimension agnostic analog of...
Definition: Triangulation.h:53
void clear()
destroys all simplex objects that have been generated and clears all lists/ sets