File tree 1 file changed +13
-5
lines changed
1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ module.exports = function(vectorfield, bounds) {
33
33
var u2 = null ;
34
34
var positionVectors = [ ] ;
35
35
var vectorScale = Infinity ;
36
+ var skipIt = false ;
36
37
for ( var i = 0 ; i < positions . length ; i ++ ) {
37
38
var p = positions [ i ] ;
38
39
minX = Math . min ( p [ 0 ] , minX ) ;
@@ -52,12 +53,19 @@ module.exports = function(vectorfield, bounds) {
52
53
//
53
54
// The vector scale corresponds to the minimum "time" to travel across two
54
55
// two adjacent positions at the average velocity of those two adjacent positions
55
- vectorScale = Math . min ( vectorScale ,
56
- 2 * vec3 . distance ( p2 , p ) / ( vec3 . length ( u2 ) + vec3 . length ( u ) )
57
- ) ;
56
+
57
+ var q = ( 2 * vec3 . distance ( p2 , p ) / ( vec3 . length ( u2 ) + vec3 . length ( u ) ) ) ;
58
+ if ( q ) {
59
+ vectorScale = Math . min ( vectorScale , q ) ;
60
+ skipIt = false ;
61
+ } else {
62
+ skipIt = true ;
63
+ }
64
+ }
65
+ if ( ! skipIt ) {
66
+ p2 = p ;
67
+ u2 = u ;
58
68
}
59
- p2 = p ;
60
- u2 = u ;
61
69
positionVectors . push ( u ) ;
62
70
}
63
71
var minV = [ minX , minY , minZ ] ;
You can’t perform that action at this time.
0 commit comments