Browse Source

Simplify edge removal heuristic

Minor weak for non-manifold scenario.

Anytime an edge is non-manifold (more than two faces sharing an edge, e.g. a 'T'), always keep the edge in the EdgesGeometry.

With the previous commit, when a third co-planar face was found, the edge was marked co-planar. I'm not sure which is right but this algorithm is a bit simpler.
dubejf 10 years ago
parent
commit
a494f7597d
1 changed files with 11 additions and 7 deletions
  1. 11 7
      src/extras/geometries/EdgesGeometry.js

+ 11 - 7
src/extras/geometries/EdgesGeometry.js

@@ -56,19 +56,23 @@ THREE.EdgesGeometry = function ( geometry, thresholdAngle ) {
 
 
 			} else {
 			} else {
 
 
-				if ( h.coplanar !== false ) {
+				if ( h.coplanar !== undefined ) {
 
 
-					var keep = ( faces[ h.face1 ].normal.dot( face.normal ) <= thresholdDot );
-
-					if ( keep === false && h.coplanar === undefined ) {
+					if ( h.coplanar === true ) {
 
 
-						numEdges --;
+						numEdges ++;
 
 
 					}
 					}
 
 
-					if ( keep === true && h.coplanar === true ) {
+					h.coplanar = false;
 
 
-						numEdges ++;
+				} else {
+
+					var keep = ( faces[ h.face1 ].normal.dot( face.normal ) <= thresholdDot );
+
+					if ( keep === false ) {
+
+						numEdges --;
 
 
 					}
 					}