|
@@ -128,7 +128,7 @@ THREE.Shape.Utils = {
|
|
|
|
|
|
function point_in_segment_2D_colin( inSegPt1, inSegPt2, inOtherPt ) {
|
|
|
// inOtherPt needs to be colinear to the inSegment
|
|
|
- if ( inSegPt1.x != inSegPt2.x ) {
|
|
|
+ if ( inSegPt1.x !== inSegPt2.x ) {
|
|
|
if ( inSegPt1.x < inSegPt2.x ) {
|
|
|
return ( ( inSegPt1.x <= inOtherPt.x ) && ( inOtherPt.x <= inSegPt2.x ) );
|
|
|
} else {
|
|
@@ -170,19 +170,19 @@ THREE.Shape.Utils = {
|
|
|
|
|
|
// i.e. to reduce rounding errors
|
|
|
// intersection at endpoint of segment#1?
|
|
|
- if ( perpSeg2 == 0 ) {
|
|
|
+ if ( perpSeg2 === 0 ) {
|
|
|
if ( ( inExcludeAdjacentSegs ) &&
|
|
|
- ( ( perpSeg1 == 0 ) || ( perpSeg1 == limit ) ) ) return [];
|
|
|
+ ( ( perpSeg1 === 0 ) || ( perpSeg1 === limit ) ) ) return [];
|
|
|
return [ inSeg1Pt1 ];
|
|
|
}
|
|
|
- if ( perpSeg2 == limit ) {
|
|
|
+ if ( perpSeg2 === limit ) {
|
|
|
if ( ( inExcludeAdjacentSegs ) &&
|
|
|
- ( ( perpSeg1 == 0 ) || ( perpSeg1 == limit ) ) ) return [];
|
|
|
+ ( ( perpSeg1 === 0 ) || ( perpSeg1 === limit ) ) ) return [];
|
|
|
return [ inSeg1Pt2 ];
|
|
|
}
|
|
|
// intersection at endpoint of segment#2?
|
|
|
- if ( perpSeg1 == 0 ) return [ inSeg2Pt1 ];
|
|
|
- if ( perpSeg1 == limit ) return [ inSeg2Pt2 ];
|
|
|
+ if ( perpSeg1 === 0 ) return [ inSeg2Pt1 ];
|
|
|
+ if ( perpSeg1 === limit ) return [ inSeg2Pt2 ];
|
|
|
|
|
|
// return real intersection point
|
|
|
var factorSeg1 = perpSeg2 / limit;
|
|
@@ -190,17 +190,17 @@ THREE.Shape.Utils = {
|
|
|
y: inSeg1Pt1.y + factorSeg1 * seg1dy } ];
|
|
|
|
|
|
} else { // parallel or colinear
|
|
|
- if ( ( perpSeg1 != 0 ) ||
|
|
|
- ( seg2dy * seg1seg2dx != seg2dx * seg1seg2dy ) ) return [];
|
|
|
+ if ( ( perpSeg1 !== 0 ) ||
|
|
|
+ ( seg2dy * seg1seg2dx !== seg2dx * seg1seg2dy ) ) return [];
|
|
|
|
|
|
// they are collinear or degenerate
|
|
|
- var seg1Pt = ( (seg1dx == 0) && (seg1dy == 0) ); // segment1 ist just a point?
|
|
|
- var seg2Pt = ( (seg2dx == 0) && (seg2dy == 0) ); // segment2 ist just a point?
|
|
|
+ var seg1Pt = ( (seg1dx === 0) && (seg1dy === 0) ); // segment1 ist just a point?
|
|
|
+ var seg2Pt = ( (seg2dx === 0) && (seg2dy === 0) ); // segment2 ist just a point?
|
|
|
// both segments are points
|
|
|
if ( seg1Pt && seg2Pt ) {
|
|
|
- if ( (inSeg1Pt1.x != inSeg2Pt1.x) ||
|
|
|
- (inSeg1Pt1.y != inSeg2Pt1.y) ) return []; // they are distinct points
|
|
|
- return [ inSeg1Pt1 ]; // they are the same point
|
|
|
+ if ( (inSeg1Pt1.x !== inSeg2Pt1.x) ||
|
|
|
+ (inSeg1Pt1.y !== inSeg2Pt1.y) ) return []; // they are distinct points
|
|
|
+ return [ inSeg1Pt1 ]; // they are the same point
|
|
|
}
|
|
|
// segment#1 is a single point
|
|
|
if ( seg1Pt ) {
|
|
@@ -216,7 +216,7 @@ THREE.Shape.Utils = {
|
|
|
// they are collinear segments, which might overlap
|
|
|
var seg1min, seg1max, seg1minVal, seg1maxVal;
|
|
|
var seg2min, seg2max, seg2minVal, seg2maxVal;
|
|
|
- if (seg1dx != 0) { // the segments are NOT on a vertical line
|
|
|
+ if (seg1dx !== 0) { // the segments are NOT on a vertical line
|
|
|
if ( inSeg1Pt1.x < inSeg1Pt2.x ) {
|
|
|
seg1min = inSeg1Pt1; seg1minVal = inSeg1Pt1.x;
|
|
|
seg1max = inSeg1Pt2; seg1maxVal = inSeg1Pt2.x;
|
|
@@ -249,7 +249,7 @@ THREE.Shape.Utils = {
|
|
|
}
|
|
|
if ( seg1minVal <= seg2minVal ) {
|
|
|
if ( seg1maxVal < seg2minVal ) return [];
|
|
|
- if ( seg1maxVal == seg2minVal ) {
|
|
|
+ if ( seg1maxVal === seg2minVal ) {
|
|
|
if ( inExcludeAdjacentSegs ) return [];
|
|
|
return [ seg2min ];
|
|
|
}
|
|
@@ -257,7 +257,7 @@ THREE.Shape.Utils = {
|
|
|
return [ seg2min, seg2max ];
|
|
|
} else {
|
|
|
if ( seg1minVal > seg2maxVal ) return [];
|
|
|
- if ( seg1minVal == seg2maxVal ) {
|
|
|
+ if ( seg1minVal === seg2maxVal ) {
|
|
|
if ( inExcludeAdjacentSegs ) return [];
|
|
|
return [ seg1min ];
|
|
|
}
|
|
@@ -574,4 +574,3 @@ THREE.Shape.Utils = {
|
|
|
}
|
|
|
|
|
|
};
|
|
|
-
|