]> git.mxchange.org Git - flightgear.git/blobdiff - Clipper/clipper.hxx
Let's not pass copies of huge structures on the stack ... ye might see a
[flightgear.git] / Clipper / clipper.hxx
index 79b7e16daa1a954f4430ea44a813fe811b750164..874d4948548479c20e98911e1dc4135ccc8e72bc 100644 (file)
@@ -48,10 +48,19 @@ extern "C" {
 #include STL_STRING
 #include <vector>
 
-typedef vector < gpc_polygon * > polylist;
-typedef polylist::iterator polylist_iterator;
+FG_USING_STD(string);
+FG_USING_STD(vector);
+
+
+typedef vector < gpc_polygon * > gpcpoly_container;
+typedef gpcpoly_container::iterator gpcpoly_iterator;
+typedef gpcpoly_container::const_iterator const_gpcpoly_iterator;
+
 
 #define FG_MAX_AREAS 20
+#define EXTRA_SAFETY_CLIP
+#define FG_MAX_VERTICES 100000
+
 
 class point2d {
 public:
@@ -59,29 +68,58 @@ public:
 };
 
 
-class FGPolyList {
+class FGgpcPolyList {
 public:
-    polylist polys[FG_MAX_AREAS];
+    gpcpoly_container polys[FG_MAX_AREAS];
     gpc_polygon safety_base;
 };
 
 
-// Initialize Clipper (allocate and/or connect structures)
-bool fgClipperInit();
+class FGClipper {
+
+private:
+
+    gpc_vertex_list v_list;
+    // static gpc_polygon poly;
+    FGgpcPolyList polys_in, polys_clipped;
+
+public:
+
+    // Constructor
+    FGClipper( void );
 
+    // Destructor
+    ~FGClipper( void );
 
-// Load a polygon definition file
-bool fgClipperLoadPolygons(const string& path);
+    // Initialize Clipper (allocate and/or connect structures)
+    bool init();
 
+    // Load a polygon definition file
+    bool load_polys(const string& path);
 
-// Do actually clipping work
-bool fgClipperMaster(const point2d& min, const point2d& max);
+    // Do actually clipping work
+    bool clip_all(const point2d& min, const point2d& max);
+
+    // return output poly list
+    inline FGgpcPolyList get_polys_clipped() const { return polys_clipped; }
+};
 
 
 #endif // _CLIPPER_HXX
 
 
 // $Log$
+// Revision 1.4  1999/03/18 04:31:10  curt
+// Let's not pass copies of huge structures on the stack ... ye might see a
+// segfault ... :-)
+//
+// Revision 1.3  1999/03/17 23:48:59  curt
+// minor renaming and a bit of rearranging.
+//
+// Revision 1.2  1999/03/13 23:51:34  curt
+// Renamed main.cxx to testclipper.cxx
+// Converted clipper routines to a class FGClipper.
+//
 // Revision 1.1  1999/03/01 15:39:39  curt
 // Initial revision.
 //