Changeset 289
- Timestamp:
- May 29, 2011, 9:41:38 PM (13 years ago)
- Location:
- experimental/TerrainTest
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/TerrainTest/ModificationVisitor.cpp
r279 r289 25 25 26 26 // Set ROI to flatten and estimated height after correction 27 _technique->setModifiedHeight( 600); // 45027 _technique->setModifiedHeight(300); // 450 28 28 29 29 ModificationManager::getInstance()->addTerrainToManage( new osgTerrain::Terrain() ); -
experimental/TerrainTest/rampedEllipsoidTechnique.cpp
r288 r289 57 57 clampValue(Y_endCore, Y_start, Y_end); 58 58 clampValue(Y_endRamp, Y_start, Y_end); 59 //OSG_NOTIFY( osg::ALWAYS ) << "Y_startRamp:" << Y_startRamp << " Y_startCore:" << Y_startCore << " Y_endCore:" << Y_endCore << " Y_endRamp:" << Y_endRamp << std::endl;59 OSG_NOTIFY( osg::ALWAYS ) << "Y_startRamp:" << Y_startRamp << " Y_startCore:" << Y_startCore << " Y_endCore:" << Y_endCore << " Y_endRamp:" << Y_endRamp << std::endl; 60 60 61 61 // Lon … … 69 69 clampValue(X_endCore, X_start, X_end); 70 70 clampValue(X_endRamp, X_start, X_end); 71 //OSG_NOTIFY( osg::ALWAYS ) << "X_startRamp:" << X_startRamp << " X_startCore:" << X_startCore << " X_endCore:" << X_endCore << " X_endRamp:" << X_endRamp << std::endl;71 OSG_NOTIFY( osg::ALWAYS ) << "X_startRamp:" << X_startRamp << " X_startCore:" << X_startCore << " X_endCore:" << X_endCore << " X_endRamp:" << X_endRamp << std::endl; 72 72 73 73 // Modify height value of affected vertices in the core ROI … … 83 83 double delta_h = _height - height_org; 84 84 // preset offset value to max and let every ramp function try to lower it... 85 double destination_height = std::numeric_limits<double>::max(); 85 double current_vertex_delta = std::numeric_limits<double>::max(); 86 double destination_height = _height; 86 87 87 88 // Calculate vertex height according to the region it is in. 88 if( Y_startCore<=y && y<=Y_endCore && X_startCore<=x && x<=X_endCore ) // If vertex is inside core: Apply final height89 {90 destination_height = _height;91 }89 //if( Y_startCore<=y && y<=Y_endCore && X_startCore<=x && x<=X_endCore ) // If vertex is inside core: Apply final height 90 //{ 91 // destination_height = _height; 92 //} 92 93 // Startramp 93 94 if(Y_startRamp<=y && y<=Y_startCore) // Vertex is inside Y start ramp … … 95 96 double delta_s = abs(modificationROI._lat_min-vertex_lat); 96 97 double gradient = delta_h/deltaLatPerSide; 97 double dest = delta_s*gradient + height_org; 98 if(dest<destination_height) 99 destination_height = dest; 98 double calculated_height = delta_s*gradient + height_org; 99 double local_test_delta = abs(calculated_height-height_org); 100 if(local_test_delta<current_vertex_delta) 101 { 102 current_vertex_delta = local_test_delta; 103 destination_height = calculated_height; 104 } 100 105 } 101 106 if(X_startRamp<=x && x<=X_startCore) // Vertex is inside X start ramp … … 103 108 double delta_s = abs(modificationROI._lon_min-vertex_lon); 104 109 double gradient = delta_h/deltaLonPerSide; 105 double dest = delta_s*gradient + height_org; 106 if(dest<destination_height) 107 destination_height = dest; 110 double calculated_height = delta_s*gradient + height_org; 111 double local_test_delta = abs(calculated_height-height_org); 112 if(local_test_delta<current_vertex_delta) 113 { 114 current_vertex_delta = local_test_delta; 115 destination_height = calculated_height; 116 } 108 117 } 109 118 // End ramp … … 112 121 double delta_s = abs(modificationROI._lat_max-vertex_lat); 113 122 double gradient = delta_h/deltaLatPerSide; 114 double dest = delta_s*gradient + height_org; 115 if(dest<destination_height) 116 destination_height = dest; 123 double calculated_height = delta_s*gradient + height_org; 124 double local_test_delta = abs(calculated_height-height_org); 125 if(local_test_delta<current_vertex_delta) 126 { 127 current_vertex_delta = local_test_delta; 128 destination_height = calculated_height; 129 } 117 130 } 118 131 if (X_endCore<=x && x<=X_endRamp) // Vertex is inside X end ramp … … 120 133 double delta_s = abs(modificationROI._lon_max-vertex_lon); 121 134 double gradient = delta_h/deltaLonPerSide; 122 double dest = delta_s*gradient + height_org; 123 if(dest<destination_height) 124 destination_height = dest; 135 double calculated_height = delta_s*gradient + height_org; 136 double local_test_delta = abs(calculated_height-height_org); 137 if(local_test_delta<current_vertex_delta) 138 { 139 current_vertex_delta = local_test_delta; 140 destination_height = calculated_height; 141 } 125 142 } 126 143 127 144 // Set height to calculated value 128 //OSG_NOTIFY( osg::ALWAYS ) << "rampedEllipsoidTechnique:destination_height=" << destination_height << std::endl;145 OSG_NOTIFY( osg::ALWAYS ) << "rampedEllipsoidTechnique: X,Y:"<<x<<","<<y<<" destination_height=" << destination_height << std::endl; 129 146 h->setHeight( x, y, destination_height); 130 147 }
Note: See TracChangeset
for help on using the changeset viewer.