Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions src/srf/boolean.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,8 @@ void SSurface::EdgeNormalsWithinSurface(Point2d auv, Point2d buv,
SSurface SSurface::MakeCopyTrimAgainst(SShell *parent,
SShell *sha, SShell *shb,
SShell *into,
SSurface::CombineAs type)
SSurface::CombineAs type,
int dbg_index)
{
bool opA = (parent == sha);
SShell *agnst = opA ? shb : sha;
Expand Down Expand Up @@ -594,9 +595,11 @@ SSurface SSurface::MakeCopyTrimAgainst(SShell *parent,

SPolygon poly = {};
final.l.ClearTags();
if(!final.AssemblePolygon(&poly, NULL, /*keepDir=*/true)) {
if(!final.AssemblePolygon(&poly, NULL, /*keepDir=*/true))
#pragma omp critical
{
into->booleanFailed = true;
dbp("failed: I=%d, avoid=%d", I, choosing.l.n);
dbp("failed: I=%d, avoid=%d", I+dbg_index, choosing.l.n);
DEBUGEDGELIST(&final, &ret);
}
poly.Clear();
Expand All @@ -609,13 +612,18 @@ SSurface SSurface::MakeCopyTrimAgainst(SShell *parent,
}

void SShell::CopySurfacesTrimAgainst(SShell *sha, SShell *shb, SShell *into, SSurface::CombineAs type) {
SSurface *ss;
for(ss = surface.First(); ss; ss = surface.NextAfter(ss)) {
#pragma omp parallel for
for (int i = 0; i < surface.n; i++)
{
SSurface *ss = &surface[i];
SSurface ssn;
ssn = ss->MakeCopyTrimAgainst(this, sha, shb, into, type);
ss->newH = into->surface.AddAndAssignId(&ssn);
I++;
ssn = ss->MakeCopyTrimAgainst(this, sha, shb, into, type, i);
#pragma omp critical
{
ss->newH = into->surface.AddAndAssignId(&ssn);
}
}
I += surface.n;
}

void SShell::MakeIntersectionCurvesAgainst(SShell *agnst, SShell *into) {
Expand Down Expand Up @@ -758,9 +766,9 @@ void SShell::MakeFromBoolean(SShell *a, SShell *b, SSurface::CombineAs type) {
// All of the BSP routines that we use to perform and accelerate polygon ops.
//-----------------------------------------------------------------------------
void SShell::MakeClassifyingBsps(SShell *useCurvesFrom) {
SSurface *ss;
for(ss = surface.First(); ss; ss = surface.NextAfter(ss)) {
ss->MakeClassifyingBsp(this, useCurvesFrom);
#pragma omp parallel for
for(int i = 0; i<surface.n; i++) {
surface[i].MakeClassifyingBsp(this, useCurvesFrom);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/srf/surface.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class SSurface {
SShell *shell, SShell *sha, SShell *shb);
void FindChainAvoiding(SEdgeList *src, SEdgeList *dest, SPointList *avoid);
SSurface MakeCopyTrimAgainst(SShell *parent, SShell *a, SShell *b,
SShell *into, SSurface::CombineAs type);
SShell *into, SSurface::CombineAs type, int dbg_index);
void TrimFromEdgeList(SEdgeList *el, bool asUv);
void IntersectAgainst(SSurface *b, SShell *agnstA, SShell *agnstB,
SShell *into);
Expand Down