1
0
Fork 0
flightgear/Triangulate/triangle.cxx

79 lines
2.2 KiB
C++

// triangle.cxx -- "Triangle" interface class
//
// Written by Curtis Olson, started March 1999.
//
// Copyright (C) 1999 Curtis L. Olson - curt@flightgear.org
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#include "triangle.hxx"
// Constructor
FGTriangle::FGTriangle( void ) {
}
// Destructor
FGTriangle::~FGTriangle( void ) {
}
// populate this class based on the specified gpc_polys list
int FGTriangle::build( const FGgpcPolyList& gpc_polys ) {
// traverse the gpc_polys and build a unified node list and a set
// of Triangle PSLG that reference the node list by index
// (starting at zero)
gpc_polygon *gpc_poly;
const_gpcpoly_iterator current, last;
// process polygons in priority order
cout << "prepairing node list and polygons" << endl;
for ( int i = 0; i < FG_MAX_AREAS; ++i ) {
cout << "area type = " << i << endl;
current = gpc_polys.polys[i].begin();
last = gpc_polys.polys[i].end();
for ( ; current != last; ++current ) {
gpc_poly = *current;
for ( int j = 0; j < gpc_poly->num_contours; j++ ) {
for ( int k = 0; k < gpc_poly->contour[j].num_vertices; k++ ) {
Point3D p( gpc_poly->contour[j].vertex[k].x,
gpc_poly->contour[j].vertex[k].y,
0 );
cout << trinodes.unique_add( p ) << endl;
}
}
}
}
return 0;
}
// $Log$
// Revision 1.2 1999/03/18 04:31:11 curt
// Let's not pass copies of huge structures on the stack ... ye might see a
// segfault ... :-)
//
// Revision 1.1 1999/03/17 23:51:59 curt
// Initial revision.
//