]> git.mxchange.org Git - flightgear.git/blob - Triangulate/trinodes.hxx
Continue shaping the code towards triangulation bliss. Added code to
[flightgear.git] / Triangulate / trinodes.hxx
1 // trinodes.hxx -- "Triangle" nodes management class
2 //
3 // Written by Curtis Olson, started March 1999.
4 //
5 // Copyright (C) 1999  Curtis L. Olson  - curt@flightgear.org
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22 // (Log is kept at end of this file)
23
24
25 #ifndef _TRINODES_HXX
26 #define _TRINODES_HXX
27
28
29 #ifndef __cplusplus                                                          
30 # error This library requires C++
31 #endif                                   
32
33
34 #include <Include/compiler.h>
35
36 #include <vector>
37
38 #include <Math/point3d.hxx>
39
40 FG_USING_STD(vector);
41
42
43 #define FG_PROXIMITY_EPSILON 0.000001
44
45
46 typedef vector < Point3D > trinode_list;
47 typedef trinode_list::iterator trinode_list_iterator;
48 typedef trinode_list::const_iterator const_trinode_list_iterator;
49
50
51 class FGTriNodes {
52
53 private:
54
55     trinode_list node_list;
56
57     // return true of the two points are "close enough" as defined by
58     // FG_PROXIMITY_EPSILON
59     bool close_enough( const Point3D& p, const Point3D& p );
60
61 public:
62
63     // Constructor and destructor
64     FGTriNodes( void );
65     ~FGTriNodes( void );
66
67     // Add a point to the point list if it doesn't already exist.
68     // Returns the index (starting at zero) of the point in the list.
69     int unique_add( const Point3D& p );
70
71     // return the master node list
72     inline trinode_list get_node_list() const { return node_list; }
73
74     // return the ith point
75     inline Point3D get_node( int i ) const { return node_list[i]; }
76 };
77
78
79 #endif // _TRINODES_HXX
80
81
82 // $Log$
83 // Revision 1.3  1999/03/20 02:21:55  curt
84 // Continue shaping the code towards triangulation bliss.  Added code to
85 // calculate some point guaranteed to be inside a polygon.
86 //
87 // Revision 1.2  1999/03/19 22:29:06  curt
88 // Working on preparationsn for triangulation.
89 //
90 // Revision 1.1  1999/03/17 23:52:00  curt
91 // Initial revision.
92 //