13int main(
int argc,
char* argv[])
16 "Moves the points of a geometry by a given displacement vector\n\n"
17 "OpenGeoSys-6 software, version " +
20 "Copyright (c) 2012-2026, OpenGeoSys Community "
21 "(http://www.opengeosys.org)",
23 TCLAP::ValueArg<double> z_arg(
"z",
"z",
"displacement in z direction",
24 false, 0.0,
"Z-DISPLACEMENT");
26 TCLAP::ValueArg<double> y_arg(
"y",
"y",
"displacement in y direction",
27 false, 0.0,
"Y-DISPLACEMENT");
29 TCLAP::ValueArg<double> x_arg(
"x",
"x",
"displacement in x direction",
30 false, 0.0,
"X-DISPLACEMENT");
32 TCLAP::ValueArg<std::string> geo_output_arg(
33 "o",
"output",
"Output (.gml) geometry file",
true,
"",
"OUTPUT_FILE");
34 cmd.add(geo_output_arg);
35 TCLAP::ValueArg<std::string> geo_input_arg(
36 "i",
"input",
"Input (.gml) geometry file",
true,
"",
"INPUT_FILE");
37 cmd.add(geo_input_arg);
39 cmd.add(log_level_arg);
40 cmd.parse(argc, argv);
49 if (!xml.
readFile(geo_input_arg.getValue()))
54 catch (std::runtime_error
const& err)
56 ERR(
"Failed to read file `{:s}'.", geo_input_arg.getValue());
57 ERR(
"{:s}", err.what());
61 Eigen::Vector3d displacement = Eigen::Vector3d::Zero();
64 displacement[0] = x_arg.getValue();
68 displacement[1] = y_arg.getValue();
72 displacement[2] = z_arg.getValue();
77 std::vector<GeoLib::Point*>
const* point_vec =
79 std::size_t
const n_points = point_vec->size();
80 for (std::size_t i = 0; i < n_points; ++i)
82 for (std::size_t c = 0; c < 3; ++c)
84 (*(*point_vec)[i])[c] += displacement[c];
90 geo_output_arg.getValue());