Working on preparationsn for triangulation.
This commit is contained in:
parent
549c167962
commit
453a82a030
3 changed files with 77 additions and 2 deletions
|
@ -68,7 +68,8 @@ int FGTriangle::build( const FGgpcPolyList& gpc_polys ) {
|
|||
|
||||
if (gpc_poly->num_contours > 1 ) {
|
||||
cout << "FATAL ERROR! no multi-contour support" << endl;
|
||||
exit(-1);
|
||||
sleep(5);
|
||||
// exit(-1);
|
||||
}
|
||||
|
||||
for ( int j = 0; j < gpc_poly->num_contours; j++ ) {
|
||||
|
@ -86,13 +87,64 @@ int FGTriangle::build( const FGgpcPolyList& gpc_polys ) {
|
|||
}
|
||||
|
||||
for ( int i = 0; i < FG_MAX_AREA_TYPES; ++i ) {
|
||||
cout << "polylist[" << i << "] = " << polylist[i].size() << endl;
|
||||
if ( polylist[i].size() ) {
|
||||
cout << get_area_name((AreaType)i) << " = "
|
||||
<< polylist[i].size() << endl;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// do actual triangulation
|
||||
int FGTriangle::do_triangulate( const tripoly& poly ) {
|
||||
point_container node_list;
|
||||
struct triangulateio in, mid, out, vorout;
|
||||
int counter;
|
||||
|
||||
// define input points
|
||||
node_list = trinodes.get_node_list();
|
||||
|
||||
in.numberofpoints = node_list.size();
|
||||
in.pointlist = (REAL *) malloc(in.numberofpoints * 2 * sizeof(REAL));
|
||||
|
||||
point_iterator current, last;
|
||||
current = node_list.begin();
|
||||
last = node_list.end();
|
||||
counter = 0;
|
||||
for ( ; current != last; ++current ) {
|
||||
in.pointlist[counter++] = current->x();
|
||||
in.pointlist[counter++] = current->y();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// triangulate each of the polygon areas
|
||||
int FGTriangle::triangulate() {
|
||||
tripoly poly;
|
||||
|
||||
tripoly_list_iterator current, last;
|
||||
|
||||
for ( int i = 0; i < FG_MAX_AREA_TYPES; ++i ) {
|
||||
cout << "area type = " << i << endl;
|
||||
current = polylist[i].begin();
|
||||
last = polylist[i].end();
|
||||
for ( ; current != last; ++current ) {
|
||||
poly = *current;
|
||||
cout << "triangulating a polygon, size = " << poly.size() << endl;
|
||||
|
||||
do_triangulate( poly );
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.4 1999/03/19 22:29:04 curt
|
||||
// Working on preparationsn for triangulation.
|
||||
//
|
||||
// Revision 1.3 1999/03/19 00:27:10 curt
|
||||
// Continued work on triangulation preparation.
|
||||
//
|
||||
|
|
|
@ -39,6 +39,11 @@
|
|||
#include <Math/point3d.hxx>
|
||||
#include <Polygon/names.hxx>
|
||||
|
||||
#define REAL double
|
||||
extern "C" {
|
||||
#include <Triangle/triangle.h>
|
||||
}
|
||||
|
||||
#include "trinodes.hxx"
|
||||
|
||||
FG_USING_STD(vector);
|
||||
|
@ -66,8 +71,17 @@ public:
|
|||
FGTriangle( void );
|
||||
~FGTriangle( void );
|
||||
|
||||
// add nodes from the dem fit
|
||||
int add_nodes();
|
||||
|
||||
// populate this class based on the specified gpc_polys list
|
||||
int build( const FGgpcPolyList& gpc_polys );
|
||||
|
||||
// do actual triangulation
|
||||
int do_triangulate( const tripoly& poly );
|
||||
|
||||
// front end triangulator for polygon list
|
||||
int triangulate();
|
||||
};
|
||||
|
||||
|
||||
|
@ -75,6 +89,9 @@ public:
|
|||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.4 1999/03/19 22:29:05 curt
|
||||
// Working on preparationsn for triangulation.
|
||||
//
|
||||
// Revision 1.3 1999/03/19 00:27:11 curt
|
||||
// Continued work on triangulation preparation.
|
||||
//
|
||||
|
|
|
@ -67,6 +67,9 @@ public:
|
|||
// Add a point to the point list if it doesn't already exist.
|
||||
// Returns the index (starting at zero) of the point in the list.
|
||||
int unique_add( const Point3D& p );
|
||||
|
||||
// return the master node list
|
||||
inline point_container get_node_list() const { return point_list; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -74,6 +77,9 @@ public:
|
|||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.2 1999/03/19 22:29:06 curt
|
||||
// Working on preparationsn for triangulation.
|
||||
//
|
||||
// Revision 1.1 1999/03/17 23:52:00 curt
|
||||
// Initial revision.
|
||||
//
|
||||
|
|
Loading…
Add table
Reference in a new issue