Skip to content

Commit

Permalink
Updated classifyBySide to only classify as front or back if polygon i…
Browse files Browse the repository at this point in the history
…s wholly in front of or behind.
  • Loading branch information
Sense545 committed Aug 3, 2018
1 parent 22d8bbc commit 6040bc2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
18 changes: 9 additions & 9 deletions ThreeCSG.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,15 @@ window.ThreeBSP = (function() {
}
}

if ( num_positive > 0 && num_negative === 0 ) {
return FRONT;
} else if ( num_positive === 0 && num_negative > 0 ) {
return BACK;
} else if ( num_positive === 0 && num_negative === 0 ) {
return COPLANAR;
} else {
return SPANNING;
}
if ( num_positive === vertice_count && num_negative === 0 ) {
return FRONT;
} else if ( num_positive === 0 && num_negative === vertice_count ) {
return BACK;
} else if ( num_positive > 0 && num_negative > 0 ) {
return SPANNING;
} else {
return COPLANAR;
}
};
ThreeBSP.Polygon.prototype.splitPolygon = function( polygon, coplanar_front, coplanar_back, front, back ) {
var classification = this.classifySide( polygon );
Expand Down
10 changes: 5 additions & 5 deletions threeCSG.es6
Original file line number Diff line number Diff line change
Expand Up @@ -299,14 +299,14 @@ class Polygon {
}
}

if (num_positive > 0 && num_negative === 0) {
if (num_positive === vertice_count && num_negative === 0) {
return FRONT;
} else if (num_positive === 0 && num_negative > 0) {
} else if (num_positive === 0 && num_negative === vertice_count) {
return BACK;
} else if (num_positive === 0 && num_negative === 0) {
return COPLANAR;
} else {
} else if (num_positive > 0 && num_negative > 0) {
return SPANNING;
} else {
return COPLANAR;
}
}

Expand Down

0 comments on commit 6040bc2

Please sign in to comment.