1
0
Fork 0

- brought in clipper (alternative to gpc)

- moved poly_extra from genapts to polygon library (add intermediate nodes)
- change TGPolyList to arrays of superpolys and texparams in preperation for
generating tex coordinates for line data
This commit is contained in:
PSadrozinski 2012-03-22 09:36:47 +01:00 committed by Christian Schmitt
parent bc3ecf8fe9
commit a6058dff58
11 changed files with 703 additions and 283 deletions

View file

@ -8,8 +8,7 @@ add_executable(genapts
global.hxx global.hxx
lights.hxx lights.cxx lights.hxx lights.cxx
main.cxx main.cxx
point2d.cxx point2d.hxx point2d.cxx point2d.hxx
poly_extra.cxx poly_extra.hxx
runway.cxx runway.hxx runway.cxx runway.hxx
rwy_common.cxx rwy_common.hxx rwy_common.cxx rwy_common.hxx
rwy_nonprec.cxx rwy_nonprec.hxx rwy_nonprec.cxx rwy_nonprec.hxx

View file

@ -48,6 +48,7 @@
#include <simgear/misc/texcoord.hxx> #include <simgear/misc/texcoord.hxx>
#include <Geometry/poly_support.hxx> #include <Geometry/poly_support.hxx>
#include <Geometry/poly_extra.hxx>
#include <Geometry/trinodes.hxx> #include <Geometry/trinodes.hxx>
#include <Output/output.hxx> #include <Output/output.hxx>
#include <Polygon/chop.hxx> #include <Polygon/chop.hxx>
@ -62,7 +63,6 @@
#include "elevations.hxx" #include "elevations.hxx"
#include "lights.hxx" #include "lights.hxx"
#include "point2d.hxx" #include "point2d.hxx"
#include "poly_extra.hxx"
#include "runway.hxx" #include "runway.hxx"
#include "rwy_common.hxx" #include "rwy_common.hxx"
#include "rwy_nonprec.hxx" #include "rwy_nonprec.hxx"

View file

@ -26,7 +26,6 @@
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include "global.hxx" #include "global.hxx"
#include "poly_extra.hxx"
#include "rwy_common.hxx" #include "rwy_common.hxx"
#include <stdlib.h> #include <stdlib.h>

View file

@ -26,7 +26,6 @@
#include <simgear/constants.h> #include <simgear/constants.h>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include "poly_extra.hxx"
#include "rwy_common.hxx" #include "rwy_common.hxx"
#include "rwy_nonprec.hxx" #include "rwy_nonprec.hxx"

View file

@ -26,7 +26,6 @@
#include <simgear/constants.h> #include <simgear/constants.h>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include "poly_extra.hxx"
#include "rwy_common.hxx" #include "rwy_common.hxx"
#include "taxiway.hxx" #include "taxiway.hxx"

View file

@ -4,6 +4,7 @@ add_library(Geometry STATIC
contour_tree.cxx contour_tree.cxx
line.cxx line.cxx
poly_support.cxx poly_support.cxx
poly_extra.cxx
rectangle.cxx rectangle.cxx
trinodes.cxx trinodes.cxx
trisegs.cxx trisegs.cxx
@ -12,6 +13,7 @@ add_library(Geometry STATIC
line.hxx line.hxx
point3d.hxx point3d.hxx
poly_support.hxx poly_support.hxx
poly_extra.hxx
rectangle.hxx rectangle.hxx
trinodes.hxx trinodes.hxx
trisegs.hxx trisegs.hxx

View file

@ -2,17 +2,17 @@
add_library(Polygon STATIC add_library(Polygon STATIC
chop-bin.cxx chop-bin.cxx
clipper.cpp
index.cxx index.cxx
polygon.cxx polygon.cxx
simple_clip.cxx simple_clip.cxx
superpoly.cxx superpoly.cxx
chop.hxx chop.hxx
clipper.hpp
index.hxx index.hxx
names.hxx names.hxx
point2d.hxx point2d.hxx
polygon.hxx polygon.hxx
simple_clip.hxx simple_clip.hxx
superpoly.hxx superpoly.hxx
clipper.cpp
clipper.hpp
) )

File diff suppressed because it is too large Load diff

View file

@ -29,40 +29,6 @@
# error This library requires C++ # error This library requires C++
#endif #endif
/* which clipping lib to use? Looks like we should go with clipper
* It appears to be both faster and generates better accuracy
*/
//#define CLIP_GPC
#define CLIP_CLIPPER
/* Set to 1 to allow keeping accum poly in native clipping lib format
* Although it seems to work on some airports, EHAM is pretty broken
* when turned on
*/
#define CLIP_NATIVE 0
#ifdef CLIP_GPC
extern "C" {
#include <gpc.h>
}
#if CLIP_NATIVE // optimization apparently causing errors
typedef gpc_polygon ClipPolyType;
#endif
#endif /* CLIP_GPC */
#ifdef CLIP_CLIPPER
#include "clipper.hpp"
using namespace ClipperLib;
#if CLIP_NATIVE // optimization apparently causing errors
typedef Polygons ClipPolyType;
#endif
#endif /* CLIP_CLIPPER */
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/math/sg_types.hxx> #include <simgear/math/sg_types.hxx>
@ -74,6 +40,50 @@ typedef Polygons ClipPolyType;
#include "point2d.hxx" #include "point2d.hxx"
/* which clipping lib to use? Looks like we should go with clipper
* It appears to be both faster and generates better accuracy
*/
// forward declaration
class TGPolygon;
#define CLIP_GPC
// #define CLIP_CLIPPER
/* Set to 1 to allow keeping accum poly in native clipping lib format
* Although it seems to work on some airports, EHAM is pretty broken
* when turned on
*/
#define CLIP_NATIVE 0
#ifdef CLIP_GPC
extern "C" {
#include <gpc.h>
}
#if CLIP_NATIVE // optimization apparently causing errors
typedef gpc_polygon ClipPolyType;
#else
typedef TGPolygon ClipPolyType;
#endif
#endif /* CLIP_GPC */
#ifdef CLIP_CLIPPER
#include "clipper.hpp"
using namespace ClipperLib;
#if CLIP_NATIVE // optimization apparently causing errors
typedef Polygons ClipPolyType;
#else
typedef TGPolygon ClipPolyType;
#endif
#endif /* CLIP_CLIPPER */
#define FG_MAX_VERTICES 1500000 #define FG_MAX_VERTICES 1500000
@ -238,10 +248,6 @@ void write_contour( const int contour, const std::string& file ) const;
}; };
#if !CLIP_NATIVE
typedef TGPolygon ClipPolyType;
#endif
typedef std::vector < TGPolygon > poly_list; typedef std::vector < TGPolygon > poly_list;
typedef poly_list::iterator poly_list_iterator; typedef poly_list::iterator poly_list_iterator;
typedef poly_list::const_iterator const_poly_list_iterator; typedef poly_list::const_iterator const_poly_list_iterator;