Skip to content

Commit

Permalink
Update clip-mesh.h
Browse files Browse the repository at this point in the history
  • Loading branch information
QuimMoya committed Oct 11, 2024
1 parent 31a9ac6 commit c87ace7
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/cpp/geometry/operations/boolean-utils/clip-mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ namespace fuzzybools
std::vector<std::vector<glm::dvec2>> edgesPrinted;
#endif

std::vector<std::pair<int, AABB>> boundingList;

for (uint32_t i = 0; i < mesh.numFaces; i++)
{
bool doit = false;
Expand All @@ -43,6 +45,35 @@ namespace fuzzybools
//continue;
}

bool doNext = true;

for(auto pair: boundingList)
{
if (aabb.intersects(pair.second))
{
Face tri_temp = mesh.GetFace(pair.first);

glm::dvec3 at = mesh.GetPoint(tri_temp.i0);
glm::dvec3 bt = mesh.GetPoint(tri_temp.i1);
glm::dvec3 ct = mesh.GetPoint(tri_temp.i2);

if((equals(at,a, EPS_MINISCULE) && equals(bt,b, EPS_MINISCULE) && equals(ct,c, EPS_MINISCULE))
|| (equals(at,b, EPS_MINISCULE) && equals(bt,c, EPS_MINISCULE) && equals(ct,a, EPS_MINISCULE))
|| (equals(at,c, EPS_MINISCULE) && equals(bt,a, EPS_MINISCULE) && equals(ct,b, EPS_MINISCULE)))
{
doNext = false;
break;
}
}
}

if(!doNext)
{
continue;
}

boundingList.push_back(std::make_pair(i, aabb));

glm::dvec3 n = computeNormal(a, b, c);

glm::dvec3 triCenter = (a + b + c) * 1.0 / 3.0;
Expand Down

0 comments on commit c87ace7

Please sign in to comment.