Fix debug visualization

This commit is contained in:
Filip Sykala - NTB T15p 2022-07-14 08:45:46 +02:00
parent 18c10c044d
commit 6f1bcd2469
2 changed files with 28 additions and 23 deletions

View File

@ -454,7 +454,6 @@ void store(const CutAOIs &aois, const CutMesh &mesh, const std::string &dir);
void store(const SurfacePatches &patches, const std::string &dir); void store(const SurfacePatches &patches, const std::string &dir);
void store(const Vec3f &vertex, const Vec3f &normal, const std::string &file, float size = 2.f); void store(const Vec3f &vertex, const Vec3f &normal, const std::string &file, float size = 2.f);
void store(const ProjectionDistances &pds, const VCutAOIs &aois, const CutMeshes &meshes, const std::string &file, float width = 0.2f/* [in mm] */); void store(const ProjectionDistances &pds, const VCutAOIs &aois, const CutMeshes &meshes, const std::string &file, float width = 0.2f/* [in mm] */);
void store(const SurfaceCuts &cut, const std::string &dir);
void store(const SurfaceCut &cut, const std::string &file, const std::string &contour_dir); void store(const SurfaceCut &cut, const std::string &file, const std::string &contour_dir);
void store(const std::vector<indexed_triangle_set> &models, const std::string &obj_filename); void store(const std::vector<indexed_triangle_set> &models, const std::string &obj_filename);
@ -3082,10 +3081,9 @@ void priv::store(const CutMesh &mesh, const ReductionMap &reduction_map, const s
for (VI reduction_from : mesh.vertices()) { for (VI reduction_from : mesh.vertices()) {
VI reduction_to = reduction_map[reduction_from]; VI reduction_to = reduction_map[reduction_from];
if (reduction_to != reduction_from) { if (!reduction_to.is_valid()) continue;
vertex_colors[reduction_from] = CGAL::Color{255, 0, 0}; vertex_colors[reduction_from] = CGAL::Color{255, 0, 0};
vertex_colors[reduction_to] = CGAL::Color{0, 0, 255}; vertex_colors[reduction_to] = CGAL::Color{0, 0, 255};
}
} }
CGAL::IO::write_OFF(off_file, mesh); CGAL::IO::write_OFF(off_file, mesh);
@ -3337,21 +3335,21 @@ indexed_triangle_set priv::create_contour_its(
return result; return result;
} }
void priv::store(const SurfaceCuts &cut, const std::string &dir) { //void priv::store(const SurfaceCuts &cut, const std::string &dir) {
prepare_dir(dir); // prepare_dir(dir);
for (const auto &c : cut) { // for (const auto &c : cut) {
size_t index = &c - &cut.front(); // size_t index = &c - &cut.front();
std::string file = dir + "cut" + std::to_string(index) + ".obj"; // std::string file = dir + "cut" + std::to_string(index) + ".obj";
its_write_obj(c, file.c_str()); // its_write_obj(c, file.c_str());
for (const auto& contour : c.contours) { // for (const auto& contour : c.contours) {
size_t c_index = &contour - &c.contours.front(); // size_t c_index = &contour - &c.contours.front();
std::string c_file = dir + "cut" + std::to_string(index) + // std::string c_file = dir + "cut" + std::to_string(index) +
"contour" + std::to_string(c_index) + ".obj"; // "contour" + std::to_string(c_index) + ".obj";
indexed_triangle_set c_its = create_contour_its(c, contour); // indexed_triangle_set c_its = create_contour_its(c, contour);
its_write_obj(c_its, c_file.c_str()); // its_write_obj(c_its, c_file.c_str());
} // }
} // }
} //}
void priv::store(const SurfaceCut &cut, const std::string &file, const std::string &contour_dir) { void priv::store(const SurfaceCut &cut, const std::string &file, const std::string &contour_dir) {
prepare_dir(contour_dir); prepare_dir(contour_dir);

View File

@ -109,9 +109,16 @@ static Emboss::OrthoProject create_projection_for_cut(
TEST_CASE("CutSurface in 3mf", "[Emboss]") TEST_CASE("CutSurface in 3mf", "[Emboss]")
{ {
std::string path_to_3mf = "C:/Users/Filip Sykala/Downloads/EmbossFromMultiVolumes.3mf"; //std::string path_to_3mf = "C:/Users/Filip Sykala/Downloads/EmbossFromMultiVolumes.3mf";
//int object_id = 0;
int object_id = 0; //int text_volume_id = 2;
//std::string path_to_3mf = "C:/Users/Filip Sykala/Downloads/treefrog.3mf";
//int object_id = 0;
//int text_volume_id = 1;
std::string path_to_3mf = "C:/Users/Filip Sykala/Downloads/cube_test.3mf";
int object_id = 1;
int text_volume_id = 2; int text_volume_id = 2;
Model model; Model model;