@@ -1450,24 +1450,22 @@ new function() { // Scope for methods that require numerical integration
14501450 y * cos + x * sin ) ;
14511451 }
14521452 var roots = [ ] ,
1453- count = Curve . solveCubic ( vcr , 1 , 0 , roots ) ;
1453+ count = Curve . solveCubic ( vcr , 1 , 0 , roots , 0 , 1 ) ;
14541454 // NOTE: count could be -1 for inifnite solutions, but that should only
14551455 // happen with lines, in which case we should not be here.
14561456 for ( var i = 0 ; i < count ; i ++ ) {
1457- var t = roots [ i ] ;
1458- if ( t >= 0 && t <= 1 ) {
1459- var point = Curve . evaluate ( vcr , t , 0 ) ;
1460- // We do have a point on the infinite line. Check if it falls on
1461- // the line *segment*.
1462- if ( point . x >= 0 && point . x <= rl2x ) {
1463- var tl = Curve . getParameterOf ( vl , point . x , point . y ) ;
1464- // Interpolate the parameter for the intersection on line.
1465- var t1 = flip ? tl : t ,
1466- t2 = flip ? t : tl ;
1467- addLocation ( locations ,
1468- curve1 , t1 , Curve . evaluate ( v1 , t1 , 0 ) ,
1469- curve2 , t2 , Curve . evaluate ( v2 , t2 , 0 ) ) ;
1470- }
1457+ var tc = roots [ i ] ,
1458+ point = Curve . evaluate ( vcr , tc , 0 ) ;
1459+ // We do have a point on the infinite line. Check if it falls on
1460+ // the line *segment*.
1461+ if ( point . x >= 0 && point . x <= rl2x ) {
1462+ var tl = Curve . getParameterOf ( vl , point . x , point . y ) ;
1463+ // Interpolate the parameter for the intersection on line.
1464+ var t1 = flip ? tl : tc ,
1465+ t2 = flip ? tc : tl ;
1466+ addLocation ( locations ,
1467+ curve1 , t1 , Curve . evaluate ( v1 , t1 , 0 ) ,
1468+ curve2 , t2 , Curve . evaluate ( v2 , t2 , 0 ) ) ;
14711469 }
14721470 }
14731471 }
0 commit comments