Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: solvespace/solvespace
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b5ccf5acf5f1
Choose a base ref
...
head repository: solvespace/solvespace
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ec3056773e2b
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Nov 23, 2019

  1. Simplify UNION and DIFFERENCE boolean operations.

    Union and difference are optimized by replacing the expression
      (!inShell && !inFace)
    which is equivqlent to
      (!inShell && !inSame && !inOpp)
    with
      outSide
    which is equivalent, since SShell::Class::OUTSIDE is the only remaining possibility.
    ruevs authored and whitequark committed Nov 23, 2019
    Copy the full SHA
    ec30567 View commit details
Showing with 5 additions and 9 deletions.
  1. +5 −9 src/srf/boolean.cpp
14 changes: 5 additions & 9 deletions src/srf/boolean.cpp
Original file line number Diff line number Diff line change
@@ -193,28 +193,24 @@ void SSurface::TrimFromEdgeList(SEdgeList *el, bool asUv) {
static bool KeepRegion(SSurface::CombineAs type, bool opA, SShell::Class shell, SShell::Class orig)
{
bool inShell = (shell == SShell::Class::INSIDE),
outSide = (shell == SShell::Class::OUTSIDE),
inSame = (shell == SShell::Class::COINC_SAME),
inOpp = (shell == SShell::Class::COINC_OPP),
inOrig = (orig == SShell::Class::INSIDE);

bool inFace = inSame || inOpp;

// If these are correct, then they should be independent of inShell
// if inFace is true.
if(!inOrig) return false;
switch(type) {
case SSurface::CombineAs::UNION:
if(opA) {
return (!inShell && !inFace);
return outSide;
} else {
return (!inShell && !inFace) || inSame;
return outSide || inSame;
}

case SSurface::CombineAs::DIFFERENCE:
if(opA) {
return (!inShell && !inFace);
return outSide;
} else {
return (inShell && !inFace) || inSame;
return inShell || inSame;
}

default: ssassert(false, "Unexpected combine type");