Do some additional processing on the airport surface grid to try to clip
out spikes and other wierdness and generally keep a reasonable bounds on how much the surface can vary.
This commit is contained in:
parent
fafab4a3a0
commit
9e9a13bbdf
1 changed files with 32 additions and 0 deletions
|
@ -126,6 +126,38 @@ static void calc_elevations( const string &root, Matrix_Point3Df &Pts ) {
|
|||
done = true;
|
||||
}
|
||||
}
|
||||
|
||||
// do some post processing for sanity's sake
|
||||
|
||||
// find the average height of the queried points
|
||||
double total = 0.0;
|
||||
int count = 0;
|
||||
for ( i = 0; i < Pts.rows(); ++i ) {
|
||||
for ( j = 0; j < Pts.cols(); ++j ) {
|
||||
Point3Df p = Pts(i,j);
|
||||
total += p.z();
|
||||
count++;
|
||||
}
|
||||
}
|
||||
double average = total / (double) count;
|
||||
cout << "Average surface height = " << average << endl;
|
||||
|
||||
// now go through the elevations and clamp them all to within
|
||||
// +/-10m (33') of the average.
|
||||
const double dz = 10.0;
|
||||
for ( i = 0; i < Pts.rows(); ++i ) {
|
||||
for ( j = 0; j < Pts.cols(); ++j ) {
|
||||
Point3Df p = Pts(i,j);
|
||||
if ( p.z() < average - dz ) {
|
||||
p.z() = average - dz;
|
||||
Pts(i,j) = p;
|
||||
}
|
||||
if ( p.z() > average + dz ) {
|
||||
p.z() = average + dz;
|
||||
Pts(i,j) = p;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue