44
55module ( "ClosedSplineCurve3" ) ;
66
7+ var threshold = 0.000001 ;
8+
79function vectorsAreEqual ( check , that ) {
810
911 if ( check . length !== that . length ) return 'Length not equal' ;
1012
1113 for ( var i = 0 ; i < check . length ; i ++ ) {
1214
13- if ( ! check [ i ] . equals ( that [ i ] ) ) {
15+ var a = check [ i ] , b = that [ i ] ;
16+ console . log ( a . distanceToSquared ( b ) )
17+
18+ if ( a . distanceToSquared ( b ) > threshold ) {
1419
15- return 'Vector differs at index ' + i ;
20+ return 'Vector differs at index ' + i +
21+ '. Should be ' + [ a . x , a . y , a . z ] +
22+ ' instead of ' + [ b . x , b . y , b . z ] ;
1623 }
1724 }
1825
@@ -45,7 +52,7 @@ test( "basic check", function() {
4552
4653 var getPoints = closedSpline . getPoints ( 10 ) ;
4754 var error = vectorsAreEqual ( getPoints , closedSplinePoints ) ;
48- ok ( getPoints . length == 11 , 'getPoints are equal.' + error ) ;
49- ok ( ! error , 'Points are equal.' + error ) ;
55+ ok ( getPoints . length == 11 , 'getPoints should be equal.' ) ;
56+ ok ( ! error , 'Lists of Vectors3 should be equal.' + error ) ;
5057
5158} ) ;
0 commit comments