Skip to content

Commit

Permalink
ci: add debug message
Browse files Browse the repository at this point in the history
  • Loading branch information
lbinria committed Aug 6, 2024
1 parent ad2824e commit 6381c24
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 11 deletions.
10 changes: 10 additions & 0 deletions src/borderOrientation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class borderOrientation {
void calculateIntersectionBorder(Triangles &triangle, Quads &quad, FacetAttribute<int> &fa, PointAttribute<int> &pa, CornerAttribute<int> &ca, std::vector<Region> &regions, bool gifmode = false) {

for (auto &region : regions) {
std::cout << "Get border vertice..." << std::endl;

std::vector<int> borderVertices = region.getBorderVertice(ca);

for (int i = 0; i < borderVertices.size(); i++) {
Expand All @@ -85,8 +87,12 @@ class borderOrientation {
if (regionMeet.size() > 2) {
std::vector<int> listRegionMeet = std::vector<int>();
listRegionMeet = std::vector<int>(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);
}
}
Expand All @@ -104,14 +110,18 @@ class borderOrientation {

for (auto &region : regions) {
int idGroup = region.getIdGroup();
std::cout << "get id group " << std::endl;
std::vector<int> borderHalfEdge = region.getBorderHalfEdge(ca);
std::cout << "get border halfedge " << std::endl;

for (auto fId : borderHalfEdge) {
auto f = Surface::Halfedge(triangle, fId);
std::string key;
if (f.opposite() == -1)
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<int>()).first;
key_it->second.insert(f.from());
Expand Down
25 changes: 21 additions & 4 deletions src/intersectData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,42 @@ 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<IntersectData>());
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()) {
if (halfedge.next().next().next().opposite() == -1 ) {
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));
Expand Down
7 changes: 7 additions & 0 deletions src/triToQuadRegion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,17 +191,24 @@ void process(Triangles &triangle, Quads &quad, FacetAttribute<int> &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<std::string, int> idVerticeFromKey = std::map<std::string, int>();
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 &region : 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);
}

Expand Down
14 changes: 7 additions & 7 deletions src/utils/normalCalculator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6381c24

Please sign in to comment.