|
@@ -1,10 +1,19 @@
|
|
|
/**
|
|
|
* @author WestLangley / http://github.com/WestLangley
|
|
|
+ * @param object THREE.Mesh whose geometry will be used
|
|
|
+ * @param hex line color
|
|
|
+ * @param thresholdAngle the minimim angle (in degrees),
|
|
|
+ * between the face normals of adjacent faces,
|
|
|
+ * that is required to render an edge. A value of 10 means
|
|
|
+ * an edge is only rendered if the angle is at least 10 degrees.
|
|
|
*/
|
|
|
|
|
|
-THREE.EdgesHelper = function ( object, hex ) {
|
|
|
+THREE.EdgesHelper = function ( object, hex, thresholdAngle ) {
|
|
|
|
|
|
var color = ( hex !== undefined ) ? hex : 0xffffff;
|
|
|
+ thresholdAngle = ( thresholdAngle !== undefined ) ? thresholdAngle : 0.1;
|
|
|
+
|
|
|
+ var thresholdDot = Math.cos( THREE.Math.degToRad( thresholdAngle ) );
|
|
|
|
|
|
var edge = [ 0, 0 ], hash = {};
|
|
|
var sortFunction = function ( a, b ) { return a - b };
|
|
@@ -67,7 +76,7 @@ THREE.EdgesHelper = function ( object, hex ) {
|
|
|
|
|
|
var h = hash[ key ];
|
|
|
|
|
|
- if ( h.face2 === undefined || faces[ h.face1 ].normal.dot( faces[ h.face2 ].normal ) < 0.9999 ) { // hardwired const OK
|
|
|
+ if ( h.face2 === undefined || faces[ h.face1 ].normal.dot( faces[ h.face2 ].normal ) <= thresholdDot ) {
|
|
|
|
|
|
var vertex = vertices[ h.vert1 ];
|
|
|
coords[ index ++ ] = vertex.x;
|