@@ -98,6 +98,11 @@ void ElevationMap::loadConfigFrom(const rapidxml::xml_node<char>* root)
98
98
std::string sDemTextFile ;
99
99
params[" dem_xyzrgb_file" ] = TParamEntry (" %s" , &sDemTextFile );
100
100
101
+ mrpt::math::TPoint3Df dem_xyz_offset = {0 , 0 , 0 };
102
+ params[" dem_offset_x" ] = TParamEntry (" %f" , &dem_xyz_offset.x );
103
+ params[" dem_offset_y" ] = TParamEntry (" %f" , &dem_xyz_offset.y );
104
+ params[" dem_offset_z" ] = TParamEntry (" %f" , &dem_xyz_offset.z );
105
+
101
106
double img_min_z = 0.0 , img_max_z = 5.0 ;
102
107
params[" elevation_image_min_z" ] = TParamEntry (" %lf" , &img_min_z);
103
108
params[" elevation_image_max_z" ] = TParamEntry (" %lf" , &img_max_z);
@@ -174,6 +179,11 @@ void ElevationMap::loadConfigFrom(const rapidxml::xml_node<char>* root)
174
179
data.loadFromTextFile (sDemTextFile );
175
180
ASSERTMSG_ (data.cols () == 6 , " DEM txt file format error: expected 6 columns (x,y,z,r,g,b)" );
176
181
182
+ // Apply optional offset:
183
+ data.col (0 ).array () += dem_xyz_offset.x ;
184
+ data.col (1 ).array () += dem_xyz_offset.y ;
185
+ data.col (2 ).array () += dem_xyz_offset.z ;
186
+
177
187
// Points from DEM geographic sources are not sorted, not even uniformly sampled.
178
188
// Let's re-sample them:
179
189
const double minx = data.col (0 ).minCoeff ();
0 commit comments