]> git.mxchange.org Git - flightgear.git/blob - Triangulate/trisegs.cxx
First mostly successful tile triangulation works. There's plenty of tweaking
[flightgear.git] / Triangulate / trisegs.cxx
1 // trisegs.cxx -- "Triangle" segment 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 #include "trisegs.hxx"
26
27
28 // Constructor 
29 FGTriSegments::FGTriSegments( void ) {
30 }
31
32
33 // Destructor
34 FGTriSegments::~FGTriSegments( void ) {
35 }
36
37
38 // Add a point to the point list if it doesn't already exist.
39 // Returns the index (starting at zero) of the point in the list.
40 int FGTriSegments::unique_add( const FGTriSeg& s ) {
41     triseg_list_iterator current, last;
42     int counter = 0;
43
44     cout << s.get_n1() << "," << s.get_n2() << endl;
45
46     // see if point already exists
47     current = seg_list.begin();
48     last = seg_list.end();
49     for ( ; current != last; ++current ) {
50         if ( s == *current ) {
51             cout << "found an existing segment match" << endl;
52             return counter;
53         }
54         
55         ++counter;
56     }
57
58     // add to list
59     seg_list.push_back( s );
60
61     return counter;
62 }
63
64
65 // $Log$
66 // Revision 1.2  1999/03/20 20:32:59  curt
67 // First mostly successful tile triangulation works.  There's plenty of tweaking
68 // to do, but we are marching in the right direction.
69 //
70 // Revision 1.1  1999/03/20 13:21:36  curt
71 // Initial revision.
72 //