Do some flattening of intermittent streams as well as roads, railroads, and
freeways.
This commit is contained in:
parent
400db7c3a9
commit
2c45b3ce5d
1 changed files with 27 additions and 3 deletions
|
@ -571,14 +571,14 @@ static void fix_point_heights( TGConstruct& c, const TGArray& array )
|
||||||
raw_nodes[i].setz( z );
|
raw_nodes[i].setz( z );
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << "flattening ocean connected nodes" << endl;
|
|
||||||
|
|
||||||
triele_list tris = c.get_tri_elements();
|
triele_list tris = c.get_tri_elements();
|
||||||
TGTriEle t;
|
TGTriEle t;
|
||||||
Point3D p;
|
Point3D p;
|
||||||
AreaType a;
|
AreaType a;
|
||||||
int n1, n2, n3;
|
int n1, n2, n3;
|
||||||
|
|
||||||
|
cout << "flattening lake connected nodes (and smoothing streams)" << endl;
|
||||||
|
|
||||||
for ( int count = 0; count < 3; ++count ) {
|
for ( int count = 0; count < 3; ++count ) {
|
||||||
for ( i = 0; i < (int)tris.size(); ++i ) {
|
for ( i = 0; i < (int)tris.size(); ++i ) {
|
||||||
double e1, e2, e3, ave, min;
|
double e1, e2, e3, ave, min;
|
||||||
|
@ -609,7 +609,8 @@ static void fix_point_heights( TGConstruct& c, const TGArray& array )
|
||||||
raw_nodes[n1].setz( min );
|
raw_nodes[n1].setz( min );
|
||||||
raw_nodes[n2].setz( min );
|
raw_nodes[n2].setz( min );
|
||||||
raw_nodes[n3].setz( min );
|
raw_nodes[n3].setz( min );
|
||||||
} else if ( (a == StreamArea) || (a == CanalArea) ) {
|
} else if ( (a == StreamArea) || (a == IntStreamArea)
|
||||||
|
|| (a == CanalArea) ) {
|
||||||
e1 = raw_nodes[n1].z();
|
e1 = raw_nodes[n1].z();
|
||||||
e2 = raw_nodes[n2].z();
|
e2 = raw_nodes[n2].z();
|
||||||
e3 = raw_nodes[n3].z();
|
e3 = raw_nodes[n3].z();
|
||||||
|
@ -626,6 +627,27 @@ static void fix_point_heights( TGConstruct& c, const TGArray& array )
|
||||||
double max2 = 1000.0 * d2 + min;
|
double max2 = 1000.0 * d2 + min;
|
||||||
double max3 = 1000.0 * d3 + min;
|
double max3 = 1000.0 * d3 + min;
|
||||||
|
|
||||||
|
if ( max1 < e1 ) { raw_nodes[n1].setz( max1 ); }
|
||||||
|
if ( max2 < e2 ) { raw_nodes[n2].setz( max2 ); }
|
||||||
|
if ( max3 < e3 ) { raw_nodes[n3].setz( max3 ); }
|
||||||
|
} else if ( (a == RoadArea) || (a == FreewayArea)
|
||||||
|
|| (a == RailroadArea) ) {
|
||||||
|
e1 = raw_nodes[n1].z();
|
||||||
|
e2 = raw_nodes[n2].z();
|
||||||
|
e3 = raw_nodes[n3].z();
|
||||||
|
|
||||||
|
min = e1; p = raw_nodes[n1];
|
||||||
|
if ( e2 < min ) { min = e2; p = raw_nodes[n2]; }
|
||||||
|
if ( e3 < min ) { min = e3; p = raw_nodes[n3]; }
|
||||||
|
|
||||||
|
double d1 = distance2D( p, raw_nodes[n1] );
|
||||||
|
double d2 = distance2D( p, raw_nodes[n2] );
|
||||||
|
double d3 = distance2D( p, raw_nodes[n3] );
|
||||||
|
|
||||||
|
double max1 = 400.0 * d1 + min;
|
||||||
|
double max2 = 400.0 * d2 + min;
|
||||||
|
double max3 = 400.0 * d3 + min;
|
||||||
|
|
||||||
if ( max1 < e1 ) { raw_nodes[n1].setz( max1 ); }
|
if ( max1 < e1 ) { raw_nodes[n1].setz( max1 ); }
|
||||||
if ( max2 < e2 ) { raw_nodes[n2].setz( max2 ); }
|
if ( max2 < e2 ) { raw_nodes[n2].setz( max2 ); }
|
||||||
if ( max3 < e3 ) { raw_nodes[n3].setz( max3 ); }
|
if ( max3 < e3 ) { raw_nodes[n3].setz( max3 ); }
|
||||||
|
@ -633,6 +655,8 @@ static void fix_point_heights( TGConstruct& c, const TGArray& array )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cout << "flattening ocean connected nodes" << endl;
|
||||||
|
|
||||||
for ( i = 0; i < (int)tris.size(); ++i ) {
|
for ( i = 0; i < (int)tris.size(); ++i ) {
|
||||||
// set all ocean nodes to 0.0
|
// set all ocean nodes to 0.0
|
||||||
t = tris[i];
|
t = tris[i];
|
||||||
|
|
Loading…
Reference in a new issue