File tree Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Original file line number Diff line number Diff line change 1
- Delaunay triangulation implemented as a C++ template:
1
+ Delaunay triangulation implemented as a C++ template. The implementation is pretty
2
+ straightforward, without any optimizaion. It runs in O(n^2) time, and might take forever
3
+ if you have more than a few hundred points.
2
4
5
+ The interface:
6
+
7
+ ```
3
8
template <typename T>
4
9
void delaunay (const std::vector<Point<T> >& pSet, std::set <Triangle>& trSet)
10
+ ```
11
+
12
+ * Input: vector of ` Point ` s
13
+ * Output: set of ` Triangle ` s
14
+
15
+ Both ` Point ` and ` Triangle ` are defined and documented in ` dtypes.h `
16
+
17
+ Typically type ` T ` is either ` float ` or ` double ` . When invoked with integer types it converts
18
+ them internally to ` double ` s.
19
+
20
+ Here is an example of invocation for a set of random points, where ` DRAND ` is expected to
21
+ return a randomly generated double-precision floating point number:
5
22
6
- Input: vector of Point's
7
- Output: set of Triangle's
23
+ ```
24
+ std::vector<Point<double> > pSet;
25
+ std::set <Triangle> trSet;
26
+ for (int k=0; k<numPoints; k++)
27
+ pSet.push_back (Point<double> (DRAND(), DRAND()));
28
+ delaunay (pSet, trSet);
29
+ ```
8
30
9
- Both Point's and Triangle's are defined in 'dtypes.h'
You can’t perform that action at this time.
0 commit comments