calculate some point guaranteed to be inside a polygon.
libTriangulate_a_SOURCES = \
triangle.cxx triangle.hxx \
- trinodes.cxx trinodes.hxx
+ trinodes.cxx trinodes.hxx \
+ tripoly.cxx tripoly.hxx
INCLUDES += \
-I$(top_builddir) \
#include "triangle.hxx"
+#include "tripoly.hxx"
// Constructor
// populate this class based on the specified gpc_polys list
int FGTriangle::build( const FGgpcPolyList& gpc_polys ) {
int index;
- tripoly poly;
-
// 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)
cout << "processing a polygon, contours = "
<< gpc_poly->num_contours << endl;
- poly.erase(poly.begin(), poly.end());
+ FGTriPoly poly;
if (gpc_poly->num_contours <= 0 ) {
cout << "FATAL ERROR! no contours in this polygon" << endl;
gpc_poly->contour[j].vertex[k].y,
0 );
index = trinodes.unique_add( p );
- poly.push_back(index);
+ poly.add_node(index);
// cout << index << endl;
}
+ poly.calc_point_inside( trinodes );
+ cout << endl;
polylist[i].push_back(poly);
}
}
// do actual triangulation
-int FGTriangle::do_triangulate( const tripoly& poly ) {
- point_container node_list;
+int FGTriangle::do_triangulate( const FGTriPoly& poly ) {
+ trinode_list node_list;
struct triangulateio in, mid, out, vorout;
int counter;
in.numberofpoints = node_list.size();
in.pointlist = (REAL *) malloc(in.numberofpoints * 2 * sizeof(REAL));
- point_iterator current, last;
+ trinode_list_iterator current, last;
current = node_list.begin();
last = node_list.end();
counter = 0;
in.pointlist[counter++] = current->x();
in.pointlist[counter++] = current->y();
}
+
+ return 0;
}
// triangulate each of the polygon areas
int FGTriangle::triangulate() {
- tripoly poly;
+ FGTriPoly poly;
tripoly_list_iterator current, last;
// $Log$
+// Revision 1.5 1999/03/20 02:21:52 curt
+// Continue shaping the code towards triangulation bliss. Added code to
+// calculate some point guaranteed to be inside a polygon.
+//
// Revision 1.4 1999/03/19 22:29:04 curt
// Working on preparationsn for triangulation.
//
-// triandgle.hxx -- "Triangle" interface class
+// triangle.hxx -- "Triangle" interface class
//
// Written by Curtis Olson, started March 1999.
//
}
#include "trinodes.hxx"
+#include "tripoly.hxx"
FG_USING_STD(vector);
-typedef vector < int > tripoly;
-typedef tripoly::iterator tripoly_iterator;
-typedef tripoly::const_iterator const_tripoly_iterator;
-
-typedef vector < tripoly > tripoly_list;
+typedef vector < FGTriPoly > tripoly_list;
typedef tripoly_list::iterator tripoly_list_iterator;
typedef tripoly_list::const_iterator const_tripoly_list_iterator;
int build( const FGgpcPolyList& gpc_polys );
// do actual triangulation
- int do_triangulate( const tripoly& poly );
+ int do_triangulate( const FGTriPoly& poly );
// front end triangulator for polygon list
int triangulate();
// $Log$
+// Revision 1.5 1999/03/20 02:21:53 curt
+// Continue shaping the code towards triangulation bliss. Added code to
+// calculate some point guaranteed to be inside a polygon.
+//
// Revision 1.4 1999/03/19 22:29:05 curt
// Working on preparationsn for triangulation.
//
// 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 FGTriNodes::unique_add( const Point3D& p ) {
- point_iterator current, last;
+ trinode_list_iterator current, last;
int counter = 0;
// cout << p.x() << "," << p.y() << endl;
// see if point already exists
- current = point_list.begin();
- last = point_list.end();
+ current = node_list.begin();
+ last = node_list.end();
for ( ; current != last; ++current ) {
if ( close_enough(p, *current) ) {
- cout << "found an existing match!" << endl;
+ // cout << "found an existing match!" << endl;
return counter;
}
}
// add to list
- point_list.push_back( p );
+ node_list.push_back( p );
return counter;
}
// $Log$
+// 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.
+//
// Revision 1.2 1999/03/19 00:27:12 curt
// Continued work on triangulation preparation.
//
#define FG_PROXIMITY_EPSILON 0.000001
-typedef vector < Point3D > point_container;
-typedef point_container::iterator point_iterator;
-typedef point_container::const_iterator const_point_iterator;
+typedef vector < Point3D > trinode_list;
+typedef trinode_list::iterator trinode_list_iterator;
+typedef trinode_list::const_iterator const_trinode_list_iterator;
class FGTriNodes {
private:
- point_container point_list;
+ trinode_list node_list;
// return true of the two points are "close enough" as defined by
// FG_PROXIMITY_EPSILON
int unique_add( const Point3D& p );
// return the master node list
- inline point_container get_node_list() const { return point_list; }
+ inline trinode_list get_node_list() const { return node_list; }
+
+ // return the ith point
+ inline Point3D get_node( int i ) const { return node_list[i]; }
};
// $Log$
+// 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.
+//
// Revision 1.2 1999/03/19 22:29:06 curt
// Working on preparationsn for triangulation.
//