1
0
Fork 0

Convert get_bounding_box to SGVec3d

This commit is contained in:
Christian Schmitt 2012-10-04 11:41:56 +02:00
parent eaec9905f7
commit edf8e8310f
4 changed files with 9 additions and 9 deletions

View file

@ -39,7 +39,7 @@ void TGConstruct::TesselatePolys( void )
{ {
// tesselate the polygons and prepair them for final output // tesselate the polygons and prepair them for final output
point_list poly_extra; point_list poly_extra;
Point3D min, max; SGVec3d min, max;
for (unsigned int area = 0; area < TG_MAX_AREA_TYPES; area++) { for (unsigned int area = 0; area < TG_MAX_AREA_TYPES; area++) {
for (unsigned int shape = 0; shape < polys_clipped.area_size(area); shape++ ) { 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); TGPolygon poly = polys_clipped.get_poly(area, shape, segment);
poly.get_bounding_box(min, max); 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 << "): " << SG_LOG( SG_CLIPPER, SG_INFO, "Tesselating " << get_area_name( (AreaType)area ) << "(" << area << "): " <<
shape+1 << "-" << segment << " of " << (int)polys_clipped.area_size(area) << shape+1 << "-" << segment << " of " << (int)polys_clipped.area_size(area) <<

View file

@ -111,14 +111,14 @@ TGPolygon add_nodes_to_poly( const TGPolygon& poly,
TGPolygon add_tgnodes_to_poly( const TGPolygon& poly, TGPolygon add_tgnodes_to_poly( const TGPolygon& poly,
const TGNodes* nodes ) { const TGNodes* nodes ) {
TGPolygon result; result.erase(); TGPolygon result; result.erase();
Point3D min, max; SGVec3d min, max;
Point3D p0, p1; Point3D p0, p1;
point_list poly_points; point_list poly_points;
poly.get_bounding_box(min, max); poly.get_bounding_box(min, max);
SG_LOG(SG_GENERAL, SG_DEBUG, "add_tgnodes_to_poly : min " << min << " max " << 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 ) { for ( int i = 0; i < poly.contours(); ++i ) {
SG_LOG(SG_GENERAL, SG_DEBUG, "contour = " << i); SG_LOG(SG_GENERAL, SG_DEBUG, "contour = " << i);

View file

@ -55,7 +55,7 @@ TGPolygon::TGPolygon( void )
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<double>::infinity(); double minx = std::numeric_limits<double>::infinity();
double miny = std::numeric_limits<double>::infinity(); double miny = std::numeric_limits<double>::infinity();
@ -64,7 +64,7 @@ void TGPolygon::get_bounding_box( Point3D& min, Point3D& max ) const
for ( int i = 0; i < contours(); i++ ) { for ( int i = 0; i < contours(); i++ ) {
for (unsigned int j = 0; j < poly[i].size(); j++) { 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() < minx ) { minx = pt.x(); }
if ( pt.x() > maxx ) { maxx = pt.x(); } if ( pt.x() > maxx ) { maxx = pt.x(); }
if ( pt.y() < miny ) { miny = pt.y(); } 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 ); min = SGVec3d( minx, miny, 0.0 );
max = Point3D( maxx, maxy, 0.0 ); max = SGVec3d( maxx, maxy, 0.0 );
} }

View file

@ -140,7 +140,7 @@ public:
poly[contour][i] = p; 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 // get and set an arbitrary point inside the specified polygon contour
inline Point3D get_point_inside( const int contour ) const inline Point3D get_point_inside( const int contour ) const