]> git.mxchange.org Git - flightgear.git/blob - Triangulate/triangle.cxx
Let's not pass copies of huge structures on the stack ... ye might see a
[flightgear.git] / Triangulate / triangle.cxx
1 // triangle.cxx -- "Triangle" interface 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 "triangle.hxx"
26
27
28 // Constructor
29 FGTriangle::FGTriangle( void ) {
30 }
31
32
33 // Destructor
34 FGTriangle::~FGTriangle( void ) {
35 }
36
37
38 // populate this class based on the specified gpc_polys list
39 int FGTriangle::build( const FGgpcPolyList& gpc_polys ) {
40     // traverse the gpc_polys and build a unified node list and a set
41     // of Triangle PSLG that reference the node list by index
42     // (starting at zero)
43
44     gpc_polygon *gpc_poly;
45     const_gpcpoly_iterator current, last;
46
47     // process polygons in priority order
48     cout << "prepairing node list and polygons" << endl;
49
50     for ( int i = 0; i < FG_MAX_AREAS; ++i ) {
51         cout << "area type = " << i << endl;
52         current = gpc_polys.polys[i].begin();
53         last = gpc_polys.polys[i].end();
54         for ( ; current != last; ++current ) {
55             gpc_poly = *current;
56
57             for ( int j = 0; j < gpc_poly->num_contours; j++ ) {
58                 for ( int k = 0; k < gpc_poly->contour[j].num_vertices; k++ ) {
59                     Point3D p( gpc_poly->contour[j].vertex[k].x,
60                                gpc_poly->contour[j].vertex[k].y,
61                                0 );
62                     cout << trinodes.unique_add( p ) << endl;
63                 }
64             }
65         }
66     }
67
68     return 0;
69 }
70
71
72 // $Log$
73 // Revision 1.2  1999/03/18 04:31:11  curt
74 // Let's not pass copies of huge structures on the stack ... ye might see a
75 // segfault ... :-)
76 //
77 // Revision 1.1  1999/03/17 23:51:59  curt
78 // Initial revision.
79 //