@@ -53,6 +53,7 @@ function Cyrus_Beck(line, poly, normals, outside)
53
53
var W2 = [ P2 [ 0 ] - F [ 0 ] , P2 [ 1 ] - F [ 1 ] ] ;
54
54
//account for trivially invisible segments
55
55
if ( multiplyScalar ( W , normals [ i ] ) < 0 && multiplyScalar ( W2 , normals [ i ] ) < 0 ) return result ;
56
+
56
57
var t = - ( multiplyScalar ( W , normals [ i ] ) ) / ( multiplyScalar ( D , normals [ i ] ) ) ;
57
58
if ( 0 <= t && t <= 1 )
58
59
{
@@ -69,20 +70,11 @@ function Cyrus_Beck(line, poly, normals, outside)
69
70
{
70
71
P1 = P ( lowerLimit ) ;
71
72
P2 = P ( upperLimit ) ;
72
- if ( ! isOnEdge ( P1 , poly ) || ! isOnEdge ( P2 , poly ) ) return result ;
73
73
}
74
74
else return result ;
75
75
}
76
- else if ( lowerLimits . length != 0 && upperLimits . length == 0 )
77
- {
78
- P1 = P ( Math . max . apply ( null , lowerLimits ) ) ;
79
- if ( ! isOnEdge ( P1 , poly ) ) return result ;
80
- }
81
- else if ( lowerLimits . length == 0 && upperLimits . length != 0 )
82
- {
83
- P2 = P ( Math . min . apply ( null , upperLimits ) ) ;
84
- if ( ! isOnEdge ( P2 , poly ) ) return result ;
85
- }
76
+ else if ( lowerLimits . length != 0 && upperLimits . length == 0 ) P1 = P ( Math . max . apply ( null , lowerLimits ) ) ;
77
+ else if ( lowerLimits . length == 0 && upperLimits . length != 0 ) P2 = P ( Math . min . apply ( null , upperLimits ) ) ;
86
78
result [ 0 ] = [ [ P1 [ 0 ] , P1 [ 1 ] , P2 [ 0 ] , P2 [ 1 ] ] ] ;
87
79
result [ 1 ] = [ [ oldLine [ 0 ] , oldLine [ 1 ] , P1 [ 0 ] , P1 [ 1 ] ] , [ oldLine [ 2 ] , oldLine [ 3 ] , P2 [ 0 ] , P2 [ 1 ] ] ] ;
88
80
if ( outside )
0 commit comments