Clean up cut surface

This commit is contained in:
Filip Sykala - NTB T15p 2022-07-13 13:15:07 +02:00
parent e0b77bb4c2
commit 4349e82d27
3 changed files with 335 additions and 675 deletions

File diff suppressed because it is too large Load Diff

View File

@ -17,41 +17,15 @@ namespace Slic3r{
/// </summary>
struct SurfaceCut : public indexed_triangle_set
{
// connected cutted surface --> inheritance is used
//indexed_triangle_set mesh;
// vertex indices(index to mesh vertices)
using Index = unsigned int;
using CutContour = std::vector<std::vector<Index>>;
using Contour = std::vector<Index>;
using Contours = std::vector<Contour>;
// list of circulated open surface
CutContour contours;
// Conversion map from vertex index to contour point
// Could be used for filtration of surface cuts
// Still I don't have an idea how to filtrate it.
// What is wanted result on wave?
// std::map<Index, ExPolygonsPoint> vertex2contour;
Contours contours;
};
using SurfaceCuts = std::vector<SurfaceCut>;
/// <summary>
/// Merge two surface cuts together
/// Added surface cut will be consumed
/// </summary>
/// <param name="sc">Surface cut to extend</param>
/// <param name="sc_add">Surface cut to consume</param>
void append(SurfaceCut &sc, SurfaceCut &&sc_add);
// call private function with same name to test it
bool merge_intersection(SurfaceCut &sc1, const SurfaceCut &sc2);
/// <summary>
/// Merge surface cuts int one
/// </summary>
/// <param name="cuts">input</param>
SurfaceCut merge(SurfaceCuts&& cuts);
/// <summary>
/// Cut surface shape from models.
/// </summary>

View File

@ -162,20 +162,4 @@ TEST_CASE("CutSurface in 3mf", "[Emboss]")
its_write_obj(cut, "C:/data/temp/cutSurface/result_cut.obj");
}
#include "libslic3r/Format/OBJ.hpp"
TEST_CASE("Merge Cuts", "[Emboss]") {
std::string dir = "C:/data/temp/";
TriangleMesh tm1, tm2;
load_obj((dir + "aoi3.obj").c_str(), &tm1);
load_obj((dir + "aoi6.obj").c_str(), &tm2);
auto create_sc = [](TriangleMesh &tm) -> SurfaceCut {
SurfaceCut sc;
sc.vertices = std::move(tm.its.vertices);
sc.indices = std::move(tm.its.indices);
// sc.contours = ???
return sc;
};
SurfaceCut sc1 = create_sc(tm1), sc2 = create_sc(tm2);
assert(merge_intersection(sc1, sc2));
}
#endif // DEBUG_3MF