diff --git a/main.cpp b/main.cpp index 1c09a91..4f31365 100644 --- a/main.cpp +++ b/main.cpp @@ -43,6 +43,7 @@ #include // glm::translate, glm::rotate, glm::scale #include // glm::perspective #include // glm::pi +#include using namespace nanogui; @@ -461,6 +462,21 @@ public: TextBox *txt_grid_res; TextBox *txt_clearance_height, *txt_start_probing_at, *txt_max_negative_z, *txt_final_z_height; + void save_heightmap(const grbl::heightmap& grid, std::string path) { + std::ofstream out(path); + if (out) { + out << "from_x:" << grid.from_x << std::endl; + out << "from_y:" << grid.from_y << std::endl; + out << "to_x:" << grid.to_x << std::endl; + out << "to_y:" << grid.to_y << std::endl; + out << "resolution:" << grid.resolution << std::endl; + out << "probes:" << grid.vertices.size() << std::endl; + for (auto& v: grid.vertices) { + out << v.x << ":" << v.y << ":" << v.z << std::endl; + } + } + } + void add_heightmap_markup() { heightmap_layer->add