From edf8e8310fb2a3612e1b6bff01e44812ce4de09b Mon Sep 17 00:00:00 2001 From: Christian Schmitt Date: Thu, 4 Oct 2012 11:41:56 +0200 Subject: [PATCH] Convert get_bounding_box to SGVec3d --- src/BuildTiles/Main/tgconstruct_tesselate.cxx | 4 ++-- src/Lib/Geometry/poly_extra.cxx | 4 ++-- src/Lib/Polygon/polygon.cxx | 8 ++++---- src/Lib/Polygon/polygon.hxx | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/BuildTiles/Main/tgconstruct_tesselate.cxx b/src/BuildTiles/Main/tgconstruct_tesselate.cxx index d2ade0b4..18b08a75 100644 --- a/src/BuildTiles/Main/tgconstruct_tesselate.cxx +++ b/src/BuildTiles/Main/tgconstruct_tesselate.cxx @@ -39,7 +39,7 @@ void TGConstruct::TesselatePolys( void ) { // tesselate the polygons and prepair them for final output point_list poly_extra; - Point3D min, max; + SGVec3d min, max; for (unsigned int area = 0; area < TG_MAX_AREA_TYPES; area++) { for (unsigned int shape = 0; shape < polys_clipped.area_size(area); shape++ ) { @@ -53,7 +53,7 @@ void TGConstruct::TesselatePolys( void ) TGPolygon poly = polys_clipped.get_poly(area, shape, segment); poly.get_bounding_box(min, max); - poly_extra = nodes.get_geod_inside( min, max ); + poly_extra = nodes.get_geod_inside( Point3D::fromSGVec3(min), Point3D::fromSGVec3(max) ); SG_LOG( SG_CLIPPER, SG_INFO, "Tesselating " << get_area_name( (AreaType)area ) << "(" << area << "): " << shape+1 << "-" << segment << " of " << (int)polys_clipped.area_size(area) << diff --git a/src/Lib/Geometry/poly_extra.cxx b/src/Lib/Geometry/poly_extra.cxx index 26cafa92..fb44925e 100644 --- a/src/Lib/Geometry/poly_extra.cxx +++ b/src/Lib/Geometry/poly_extra.cxx @@ -111,14 +111,14 @@ TGPolygon add_nodes_to_poly( const TGPolygon& poly, TGPolygon add_tgnodes_to_poly( const TGPolygon& poly, const TGNodes* nodes ) { TGPolygon result; result.erase(); - Point3D min, max; + SGVec3d min, max; Point3D p0, p1; point_list poly_points; poly.get_bounding_box(min, max); SG_LOG(SG_GENERAL, SG_DEBUG, "add_tgnodes_to_poly : min " << min << " max " << max ); - poly_points = nodes->get_geod_inside( min, max ); + poly_points = nodes->get_geod_inside( Point3D::fromSGVec3(min), Point3D::fromSGVec3(max) ); for ( int i = 0; i < poly.contours(); ++i ) { SG_LOG(SG_GENERAL, SG_DEBUG, "contour = " << i); diff --git a/src/Lib/Polygon/polygon.cxx b/src/Lib/Polygon/polygon.cxx index 4ce9fbcd..3865430b 100644 --- a/src/Lib/Polygon/polygon.cxx +++ b/src/Lib/Polygon/polygon.cxx @@ -55,7 +55,7 @@ TGPolygon::TGPolygon( void ) TGPolygon::~TGPolygon( void ) { } -void TGPolygon::get_bounding_box( Point3D& min, Point3D& max ) const +void TGPolygon::get_bounding_box( SGVec3d& min, SGVec3d& max ) const { double minx = std::numeric_limits::infinity(); double miny = std::numeric_limits::infinity(); @@ -64,7 +64,7 @@ void TGPolygon::get_bounding_box( Point3D& min, Point3D& max ) const for ( int i = 0; i < contours(); i++ ) { for (unsigned int j = 0; j < poly[i].size(); j++) { - Point3D pt = poly[i][j]; + SGVec3d pt = poly[i][j].toSGVec3d(); if ( pt.x() < minx ) { minx = pt.x(); } if ( pt.x() > maxx ) { maxx = pt.x(); } if ( pt.y() < miny ) { miny = pt.y(); } @@ -72,8 +72,8 @@ void TGPolygon::get_bounding_box( Point3D& min, Point3D& max ) const } } - min = Point3D( minx, miny, 0.0 ); - max = Point3D( maxx, maxy, 0.0 ); + min = SGVec3d( minx, miny, 0.0 ); + max = SGVec3d( maxx, maxy, 0.0 ); } diff --git a/src/Lib/Polygon/polygon.hxx b/src/Lib/Polygon/polygon.hxx index e114a87e..b489335a 100644 --- a/src/Lib/Polygon/polygon.hxx +++ b/src/Lib/Polygon/polygon.hxx @@ -140,7 +140,7 @@ public: poly[contour][i] = p; } - void get_bounding_box( Point3D& min, Point3D& max ) const; + void get_bounding_box( SGVec3d& min, SGVec3d& max ) const; // get and set an arbitrary point inside the specified polygon contour inline Point3D get_point_inside( const int contour ) const