f_current = fit_list.begin();
f_last = fit_list.end();
for ( ; f_current != f_last; ++f_current ) {
- index = trinodes.unique_add( *f_current );
+ index = in_nodes.unique_add( *f_current );
}
gpc_polygon *gpc_poly;
Point3D p( gpc_poly->contour[j].vertex[k].x,
gpc_poly->contour[j].vertex[k].y,
0 );
- index = trinodes.unique_add( p );
- // junkp = trinodes.get_node( index );
+ index = in_nodes.unique_add( p );
+ // junkp = in_nodes.get_node( index );
// fprintf(junkfp, "%.4f %.4f\n", junkp.x(), junkp.y());
poly.add_node(index);
// cout << index << endl;
// gpc_poly->contour[j].vertex[0].y);
// fclose(junkfp);
- poly.calc_point_inside( trinodes );
+ poly.calc_point_inside( in_nodes );
polylist[i].push_back(poly);
}
int counter;
// point list
- trinode_list node_list = trinodes.get_node_list();
+ trinode_list node_list = in_nodes.get_node_list();
in.numberofpoints = node_list.size();
in.pointlist = (REAL *) malloc(in.numberofpoints * 2 * sizeof(REAL));
triseg_list seg_list = trisegs.get_seg_list();
in.numberofsegments = seg_list.size();
in.segmentlist = (int *) malloc(in.numberofsegments * 2 * sizeof(int));
+ in.segmentmarkerlist = (int *) NULL;
triseg_list_iterator s_current, s_last;
s_current = seg_list.begin();
// TEMPORARY
write_out_data(&out);
+ // now copy the results back into the corresponding FGTriangle
+ // structures
+
+ // nodes
+ for ( int i = 0; i < out.numberofpoints; i++ ) {
+ Point3D p( out.pointlist[2*i], out.pointlist[2*i + 1], 0.0 );
+ // cout << "point = " << p << endl;
+ out_nodes.simple_add( p );
+ }
+
+ // triangles
+ int n1, n2, n3;
+ for ( int i = 0; i < out.numberoftriangles; i++ ) {
+ n1 = out.trianglelist[i * 3];
+ n2 = out.trianglelist[i * 3 + 1];
+ n3 = out.trianglelist[i * 3 + 2];
+ // cout << "triangle = " << n1 << " " << n2 << " " << n3 << endl;
+
+ elelist.push_back( FGTriEle( n1, n2, n3 ) );
+ }
+
// free mem allocated to the "Triangle" structures
free(in.pointlist);
free(in.pointattributelist);
// $Log$
+// Revision 1.10 1999/03/22 23:49:02 curt
+// Modifications to facilitate conversion to output format.
+//
// Revision 1.9 1999/03/21 15:48:02 curt
// Removed Dem2node from the Tools fold.
// Tweaked the triangulator options to add quality mesh refinement.
#include <Triangle/triangle.h>
}
+#include "trieles.hxx"
#include "trinodes.hxx"
#include "tripoly.hxx"
#include "trisegs.hxx"
typedef tripoly_list::iterator tripoly_list_iterator;
typedef tripoly_list::const_iterator const_tripoly_list_iterator;
+typedef vector < FGTriEle > triele_list;
+typedef triele_list::iterator triele_list_iterator;
+typedef triele_list::const_iterator const_triele_list_iterator;
+
class FGTriangle {
private:
// list of nodes
- FGTriNodes trinodes;
+ FGTriNodes in_nodes;
+ FGTriNodes out_nodes;
// list of segments
FGTriSegments trisegs;
// polygon list
tripoly_list polylist[FG_MAX_AREA_TYPES];
+ // triangle list
+ triele_list elelist;
+
public:
// Constructor and destructor
// front end triangulator for polygon list
int run_triangulate();
+
+ inline FGTriNodes get_out_nodes() const { return out_nodes; }
};
// $Log$
+// Revision 1.7 1999/03/22 23:49:03 curt
+// Modifications to facilitate conversion to output format.
+//
// Revision 1.6 1999/03/20 20:32:56 curt
// First mostly successful tile triangulation works. There's plenty of tweaking
// to do, but we are marching in the right direction.
}
+// Add the point with no uniqueness checking
+int FGTriNodes::simple_add( const Point3D& p ) {
+ node_list.push_back( p );
+
+ return node_list.size() - 1;
+}
+
+
// $Log$
+// Revision 1.4 1999/03/22 23:49:04 curt
+// Modifications to facilitate conversion to output format.
+//
// Revision 1.3 1999/03/20 02:21:54 curt
// Continue shaping the code towards triangulation bliss. Added code to
// calculate some point guaranteed to be inside a polygon.
// Returns the index (starting at zero) of the point in the list.
int unique_add( const Point3D& p );
+ // Add the point with no uniqueness checking
+ int simple_add( const Point3D& p );
+
// return the master node list
inline trinode_list get_node_list() const { return node_list; }
// $Log$
+// Revision 1.4 1999/03/22 23:49:05 curt
+// Modifications to facilitate conversion to output format.
+//
// Revision 1.3 1999/03/20 02:21:55 curt
// Continue shaping the code towards triangulation bliss. Added code to
// calculate some point guaranteed to be inside a polygon.