diff --git a/src/borderOrientation.cpp b/src/borderOrientation.cpp index 9ef10a3..1531ceb 100644 --- a/src/borderOrientation.cpp +++ b/src/borderOrientation.cpp @@ -68,6 +68,8 @@ class borderOrientation { void calculateIntersectionBorder(Triangles &triangle, Quads &quad, FacetAttribute &fa, PointAttribute &pa, CornerAttribute &ca, std::vector ®ions, bool gifmode = false) { for (auto ®ion : regions) { + std::cout << "Get border vertice..." << std::endl; + std::vector borderVertices = region.getBorderVertice(ca); for (int i = 0; i < borderVertices.size(); i++) { @@ -85,8 +87,12 @@ class borderOrientation { if (regionMeet.size() > 2) { std::vector listRegionMeet = std::vector(); listRegionMeet = std::vector(regionMeet.begin(), regionMeet.end()); + std::cout << "Generate key name..." << std::endl; + std::string key = generatorKeyNameList(listRegionMeet); intersectMapBorder[key] = borderVertices[i]; + std::cout << "Fill intersect..." << std::endl; + fillIntersect(key, borderVertices[i], triangle, fa); } } @@ -104,7 +110,10 @@ class borderOrientation { for (auto ®ion : regions) { int idGroup = region.getIdGroup(); + std::cout << "get id group " << std::endl; std::vector borderHalfEdge = region.getBorderHalfEdge(ca); + std::cout << "get border halfedge " << std::endl; + for (auto fId : borderHalfEdge) { auto f = Surface::Halfedge(triangle, fId); std::string key; @@ -112,6 +121,7 @@ class borderOrientation { key = generateKeyName(idGroup, borderOut); else key = generateKeyName(idGroup, fa[f.opposite().facet()]); + std::cout << "gen keyframe " << std::endl; auto key_it = mapBorder.emplace(key, std::set()).first; key_it->second.insert(f.from()); diff --git a/src/intersectData.cpp b/src/intersectData.cpp index d222b35..4b3b9d5 100644 --- a/src/intersectData.cpp +++ b/src/intersectData.cpp @@ -53,18 +53,34 @@ void fillIntersect(std::string keyIntersect, int vertices, Triangles &triangle, for (auto halfedge: verticesIntersect.iter_halfedges()) { processed++; auto f = Surface::Halfedge(triangle, halfedge); + std::cout << "regionfacet..." << std::endl; auto region = regionFacet[f.facet()]; - auto regionOposite = regionFacet[f.opposite().facet()]; - if (f.opposite() == -1) { - regionOposite = borderOut; - } + std::cout << "regionfacet opp..." << std::endl; + + auto regionOposite = f.opposite().active() ? regionFacet[f.opposite().facet()] : borderOut; + // if (f.opposite() == -1) { + std::cout << "activdo..." << std::endl; + + // if (!f.opposite().active()) { + // regionOposite = borderOut; + // } + std::cout << "gen key..." << std::endl; std::string key = generateKey(region, regionOposite); + std::cout << "emplace..." << std::endl; + intersectDataFolder.emplace(keyIntersect,std::vector()); + std::cout << "push..." << std::endl; intersectDataFolder[keyIntersect].push_back(IntersectData(key, std::to_string(region), Mode::OUTPUT)); + std::cout << "push..." << std::endl; + intersectDataFolder[keyIntersect].push_back(IntersectData(key, std::to_string(regionOposite), Mode::INPUT)); + std::cout << "posh..." << std::endl; + } + std::cout << "isElementString..." << std::endl; + // Case where the intersect has a border with void and so the halfedge doesn't exist if (isElementInString(keyIntersect, borderOut) == true) { for (auto halfedge: verticesIntersect.iter_halfedges()) { @@ -72,6 +88,7 @@ void fillIntersect(std::string keyIntersect, int vertices, Triangles &triangle, auto f = Surface::Halfedge(triangle, halfedge); auto region = regionFacet[f.facet()]; auto regionOposite = borderOut; + std::cout << "generateKey..." << std::endl; std::string key = generateKey(region, regionOposite); intersectDataFolder[keyIntersect].push_back(IntersectData(key, std::to_string(region), Mode::OUTPUT)); diff --git a/src/region.h b/src/region.h index fec31a2..841c86a 100644 --- a/src/region.h +++ b/src/region.h @@ -151,14 +151,17 @@ class Region { auto v1 = f.halfedge(1); auto v2 = f.halfedge(2); + std::cout << "a" << std::endl; if (!isElementInVector(region, v0.opposite().facet()) || v0.opposite() == -1) { border.push_back(v0); ca[v0] = idGroup; } + std::cout << "b" << std::endl; if (!isElementInVector(region, v1.opposite().facet()) || v1.opposite() == -1) { border.push_back(v1); ca[v1] = idGroup; } + std::cout << "c" << std::endl; if (!isElementInVector(region, v2.opposite().facet()) || v2.opposite() == -1) { border.push_back(v2); ca[v2] = idGroup; diff --git a/src/triToQuadRegion.cpp b/src/triToQuadRegion.cpp index d92856a..9aafff6 100644 --- a/src/triToQuadRegion.cpp +++ b/src/triToQuadRegion.cpp @@ -191,17 +191,24 @@ void process(Triangles &triangle, Quads &quad, FacetAttribute &fa, PointAtt borderOrientation borderOrientation; + std::cout << "Calculate border..." << std::endl; borderOrientation.calculateBorder(triangle, quad, fa, pa, ca, regions, gifmode); + std::cout << "Calculate section border..." << std::endl; borderOrientation.calculateIntersectionBorder(triangle, quad, fa, pa, ca, regions, gifmode); + std::cout << "Map<>..." << std::endl; std::map idVerticeFromKey = std::map(); intersectIndex = regions.size(); + std::cout << "Map intersection border..." << std::endl; borderIndex = intersectIndex + borderOrientation.getMapIntersectBorder().size(); quad.points.create_points(regions.size() + borderOrientation.getMapIntersectBorder().size() + borderOrientation.getMapBorder().size()); + std::cout << "Transform quads..." << std::endl; for (auto ®ion : regions) { //continue; transformQuad(triangle, quad, fa, pa, ca, region, borderOrientation, idVerticeFromKey, faQuad, gifmode); } + std::cout << "Connect..." << std::endl; quad.connect(); + std::cout << "Smooth..." << std::endl; smoothFacet(quad); } diff --git a/src/utils/normalCalculator.h b/src/utils/normalCalculator.h index 195dfb6..6372600 100644 --- a/src/utils/normalCalculator.h +++ b/src/utils/normalCalculator.h @@ -64,13 +64,13 @@ void testNormal() { UM::vec3 v1 = UM::vec3(1, 0, 0); UM::vec3 v2 = UM::vec3(0, 1, 0); UM::vec3 v3 = UM::vec3(0, 1, 0); - - assert(calculateNormalTriangle(v0, v1, v2) == UM::vec3(0, 0, 1)); - assert(calculateNormalTriangle(v0, v2, v3) == UM::vec3(1, 0, 0)); - assert(calculateNormalTriangle(v0, v1, v3) == UM::vec3(0, 1, 0)); - assert(calculateNormalTriangle(v0, v2, v1) == UM::vec3(0, 0, -1)); - assert(calculateNormalTriangle(v1, v2, v0) == UM::vec3(0, 0, 1)); - assert(calculateNormalTriangle(v1, v0, v2) == UM::vec3(0, 0, -1)); + + assert((calculateNormalTriangle(v0, v1, v2) - UM::vec3(0, 0, 1)).norm2() < 1e-4); + assert((calculateNormalTriangle(v0, v2, v3) - UM::vec3(1, 0, 0)).norm2() < 1e-4); + assert((calculateNormalTriangle(v0, v1, v3) - UM::vec3(0, 1, 0)).norm2() < 1e-4); + assert((calculateNormalTriangle(v0, v2, v1) - UM::vec3(0, 0, -1)).norm2() < 1e-4); + assert((calculateNormalTriangle(v1, v2, v0) - UM::vec3(0, 0, 1)).norm2() < 1e-4); + assert((calculateNormalTriangle(v1, v0, v2) - UM::vec3(0, 0, -1)).norm2() < 1e-4); std::cout << "Test normal passed" << std::endl;