1
0
Fork 0

Issue 888: Apply to newconstruct: Correctly calculate the bucket center and radius.

The previous routine lead to offsets in the verts and
thus to problems in the transition shaders.
This commit is contained in:
Christian Schmitt 2012-10-06 16:57:16 +02:00
parent 29e77c4c40
commit eaec9905f7

View file

@ -173,15 +173,17 @@ void TGConstruct::WriteBtgFile( void )
}
std::vector< SGVec3d > wgs84_nodes = nodes.get_wgs84_nodes_as_SGVec3d();
SGSphered d;
SGVec3d gbs_center = SGVec3d::fromGeod( bucket.get_center() );
double dist_squared, radius_squared = 0;
for (int i = 0; i < (int)wgs84_nodes.size(); ++i)
{
d.expandBy(wgs84_nodes[ i ]);
dist_squared = distSqr(gbs_center, wgs84_nodes[i]);
if ( dist_squared > radius_squared ) {
radius_squared = dist_squared;
}
}
double gbs_radius = sqrt(radius_squared);
SGVec3d gbs_center = d.getCenter();
double gbs_radius = d.getRadius();
SG_LOG(SG_GENERAL, SG_DEBUG, "gbs center = " << gbs_center);
SG_LOG(SG_GENERAL, SG_DEBUG, "Done with wgs84 node mapping");
SG_LOG(SG_GENERAL, SG_DEBUG, " center = " << gbs_center << " radius = " << gbs_radius );