Skip to content

Commit

Permalink
change renderMesh triangle check to single assert
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankenny committed Nov 22, 2014
1 parent a35c63c commit e1cbdf3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
17 changes: 4 additions & 13 deletions libtess.cat.js
Original file line number Diff line number Diff line change
Expand Up @@ -1465,7 +1465,6 @@ libtess.normal.checkOrientation_ = function(tess) {
};



/* global libtess */

/** @const */
Expand Down Expand Up @@ -1498,19 +1497,11 @@ libtess.render.renderMesh = function(tess, mesh, flagEdges) {
beginOrBeginDataCalled = true;
}

// Loop once for each edge (there will always be 3 edges)
if (libtess.DEBUG) {
// check that face has only three edges
var edge = f.anEdge;
var edgeCount = 0;
do {
edgeCount++;
edge = edge.lNext;
} while (edge !== f.anEdge);
libtess.assert(edgeCount === 3,
'renderMesh called with non-triangulated mesh');
}
// check that face has only three edges
var e = f.anEdge;
libtess.assert(e.lNext.lNext.lNext === e,
'renderMesh called with non-triangulated mesh');
// Loop once for each edge (there will always be 3 edges)
do {
if (flagEdges) {
// Set the "edge state" to true just before we output the
Expand Down
17 changes: 4 additions & 13 deletions src/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
*/

/* global libtess */

/** @const */
Expand Down Expand Up @@ -59,19 +58,11 @@ libtess.render.renderMesh = function(tess, mesh, flagEdges) {
beginOrBeginDataCalled = true;
}

// Loop once for each edge (there will always be 3 edges)
if (libtess.DEBUG) {
// check that face has only three edges
var edge = f.anEdge;
var edgeCount = 0;
do {
edgeCount++;
edge = edge.lNext;
} while (edge !== f.anEdge);
libtess.assert(edgeCount === 3,
'renderMesh called with non-triangulated mesh');
}
// check that face has only three edges
var e = f.anEdge;
libtess.assert(e.lNext.lNext.lNext === e,
'renderMesh called with non-triangulated mesh');
// Loop once for each edge (there will always be 3 edges)
do {
if (flagEdges) {
// Set the "edge state" to true just before we output the
Expand Down

0 comments on commit e1cbdf3

Please sign in to comment.