diff --git a/src/core/Geometry.js b/src/core/Geometry.js index 6cba80fc..68b99770 100644 --- a/src/core/Geometry.js +++ b/src/core/Geometry.js @@ -498,8 +498,8 @@ THREE.Geometry.prototype = { // should shared edge be included? // comment out if not - hash = edge_hash( face.b, face.d ); - addToMap( vfMap, hash, i ); + // hash = edge_hash( face.b, face.d ); + // addToMap( vfMap, hash, i ); hash = edge_hash( face.a, face.b ); addToMap( vfMap, hash, i ); @@ -518,24 +518,40 @@ THREE.Geometry.prototype = { } // extract faces - - for( i = 0, il = this.edges.length; i < il; i ++ ) { - - edge = this.edges[ i ]; - - v1 = edge.vertexIndices[ 0 ]; - v2 = edge.vertexIndices[ 1 ]; - - edge.faceIndices = vfMap[ edge_hash( v1, v2 ) ].array; - - for( j = 0; j < edge.faceIndices.length; j ++ ) { - - faceIndex = edge.faceIndices[ j ]; - edge.faces.push( this.faces[ faceIndex ] ); - - } - + + + this.vfMap = vfMap; + + var numOfEdges = 0; + for (i in vfMap) { + numOfEdges++; + + edge = vfMap[i]; + this.edges.push(edge.array); + } + + //console.log('vfMap', vfMap, 'this.edges',this.edges, 'numOfEdges', numOfEdges); + + // Not sure what the below does. + + // for( i = 0, il = this.edges.length; i < il; i ++ ) { + // + // edge = this.edges[ i ]; + // + // v1 = edge.vertexIndices[ 0 ]; + // v2 = edge.vertexIndices[ 1 ]; + // + // edge.faceIndices = vfMap[ edge_hash( v1, v2 ) ].array; + // + // for( j = 0; j < edge.faceIndices.length; j ++ ) { + // + // faceIndex = edge.faceIndices[ j ]; + // edge.faces.push( this.faces[ faceIndex ] ); + // + // } + // + // } }