@math.gl/polygon
Advanced tools
Comparing version
@@ -166,4 +166,4 @@ "use strict"; | ||
var resultHigh = []; | ||
var typesLow = edgeTypes && []; | ||
var typesHigh = edgeTypes && []; | ||
var typesLow = []; | ||
var typesHigh = []; | ||
var scratchPoint = []; | ||
@@ -186,35 +186,20 @@ var p; | ||
(0, _lineclip.intersect)(prev, p, edge, bbox, scratchPoint); | ||
(0, _utils.push)(resultLow, scratchPoint); | ||
(0, _utils.push)(resultHigh, scratchPoint); | ||
if (edgeTypes) { | ||
typesLow.push(prevType); | ||
typesHigh.push(prevType); | ||
} | ||
(0, _utils.push)(resultLow, scratchPoint) && typesLow.push(prevType); | ||
(0, _utils.push)(resultHigh, scratchPoint) && typesHigh.push(prevType); | ||
} | ||
if (side <= 0) { | ||
(0, _utils.push)(resultLow, p); | ||
(0, _utils.push)(resultLow, p) && typesLow.push(type); | ||
lowPointCount -= side; | ||
} else if (typesLow.length) { | ||
typesLow[typesLow.length - 1] = TYPE_INSIDE; | ||
} | ||
if (side >= 0) { | ||
(0, _utils.push)(resultHigh, p); | ||
(0, _utils.push)(resultHigh, p) && typesHigh.push(type); | ||
highPointCount += side; | ||
} else if (typesHigh.length) { | ||
typesHigh[typesHigh.length - 1] = TYPE_INSIDE; | ||
} | ||
if (edgeTypes) { | ||
if (side <= 0) { | ||
typesLow.push(type); | ||
} else if (typesLow.length) { | ||
typesLow[typesLow.length - 1] = TYPE_INSIDE; | ||
} | ||
if (side >= 0) { | ||
typesHigh.push(type); | ||
} else if (typesHigh.length) { | ||
typesHigh[typesHigh.length - 1] = TYPE_INSIDE; | ||
} | ||
} | ||
(0, _utils.copy)(prev, p); | ||
@@ -227,6 +212,6 @@ prevSide = side; | ||
pos: resultLow, | ||
types: typesLow | ||
types: edgeTypes && typesLow | ||
} : null, highPointCount ? { | ||
pos: resultHigh, | ||
types: typesHigh | ||
types: edgeTypes && typesHigh | ||
} : null]; | ||
@@ -233,0 +218,0 @@ } |
@@ -25,3 +25,3 @@ "use strict"; | ||
if (isDuplicate) { | ||
return; | ||
return false; | ||
} | ||
@@ -33,2 +33,4 @@ } | ||
} | ||
return true; | ||
} | ||
@@ -35,0 +37,0 @@ |
@@ -145,4 +145,4 @@ import { bitCode, intersect } from './lineclip'; | ||
const resultHigh = []; | ||
const typesLow = edgeTypes && []; | ||
const typesHigh = edgeTypes && []; | ||
const typesLow = []; | ||
const typesHigh = []; | ||
const scratchPoint = []; | ||
@@ -165,35 +165,20 @@ let p; | ||
intersect(prev, p, edge, bbox, scratchPoint); | ||
push(resultLow, scratchPoint); | ||
push(resultHigh, scratchPoint); | ||
if (edgeTypes) { | ||
typesLow.push(prevType); | ||
typesHigh.push(prevType); | ||
} | ||
push(resultLow, scratchPoint) && typesLow.push(prevType); | ||
push(resultHigh, scratchPoint) && typesHigh.push(prevType); | ||
} | ||
if (side <= 0) { | ||
push(resultLow, p); | ||
push(resultLow, p) && typesLow.push(type); | ||
lowPointCount -= side; | ||
} else if (typesLow.length) { | ||
typesLow[typesLow.length - 1] = TYPE_INSIDE; | ||
} | ||
if (side >= 0) { | ||
push(resultHigh, p); | ||
push(resultHigh, p) && typesHigh.push(type); | ||
highPointCount += side; | ||
} else if (typesHigh.length) { | ||
typesHigh[typesHigh.length - 1] = TYPE_INSIDE; | ||
} | ||
if (edgeTypes) { | ||
if (side <= 0) { | ||
typesLow.push(type); | ||
} else if (typesLow.length) { | ||
typesLow[typesLow.length - 1] = TYPE_INSIDE; | ||
} | ||
if (side >= 0) { | ||
typesHigh.push(type); | ||
} else if (typesHigh.length) { | ||
typesHigh[typesHigh.length - 1] = TYPE_INSIDE; | ||
} | ||
} | ||
copy(prev, p); | ||
@@ -206,6 +191,6 @@ prevSide = side; | ||
pos: resultLow, | ||
types: typesLow | ||
types: edgeTypes && typesLow | ||
} : null, highPointCount ? { | ||
pos: resultHigh, | ||
types: typesHigh | ||
types: edgeTypes && typesHigh | ||
} : null]; | ||
@@ -212,0 +197,0 @@ } |
@@ -16,3 +16,3 @@ export function push(target, source) { | ||
if (isDuplicate) { | ||
return; | ||
return false; | ||
} | ||
@@ -24,2 +24,4 @@ } | ||
} | ||
return true; | ||
} | ||
@@ -26,0 +28,0 @@ export function copy(target, source) { |
@@ -154,4 +154,4 @@ import { bitCode, intersect } from './lineclip'; | ||
var resultHigh = []; | ||
var typesLow = edgeTypes && []; | ||
var typesHigh = edgeTypes && []; | ||
var typesLow = []; | ||
var typesHigh = []; | ||
var scratchPoint = []; | ||
@@ -174,35 +174,20 @@ var p; | ||
intersect(prev, p, edge, bbox, scratchPoint); | ||
push(resultLow, scratchPoint); | ||
push(resultHigh, scratchPoint); | ||
if (edgeTypes) { | ||
typesLow.push(prevType); | ||
typesHigh.push(prevType); | ||
} | ||
push(resultLow, scratchPoint) && typesLow.push(prevType); | ||
push(resultHigh, scratchPoint) && typesHigh.push(prevType); | ||
} | ||
if (side <= 0) { | ||
push(resultLow, p); | ||
push(resultLow, p) && typesLow.push(type); | ||
lowPointCount -= side; | ||
} else if (typesLow.length) { | ||
typesLow[typesLow.length - 1] = TYPE_INSIDE; | ||
} | ||
if (side >= 0) { | ||
push(resultHigh, p); | ||
push(resultHigh, p) && typesHigh.push(type); | ||
highPointCount += side; | ||
} else if (typesHigh.length) { | ||
typesHigh[typesHigh.length - 1] = TYPE_INSIDE; | ||
} | ||
if (edgeTypes) { | ||
if (side <= 0) { | ||
typesLow.push(type); | ||
} else if (typesLow.length) { | ||
typesLow[typesLow.length - 1] = TYPE_INSIDE; | ||
} | ||
if (side >= 0) { | ||
typesHigh.push(type); | ||
} else if (typesHigh.length) { | ||
typesHigh[typesHigh.length - 1] = TYPE_INSIDE; | ||
} | ||
} | ||
copy(prev, p); | ||
@@ -215,6 +200,6 @@ prevSide = side; | ||
pos: resultLow, | ||
types: typesLow | ||
types: edgeTypes && typesLow | ||
} : null, highPointCount ? { | ||
pos: resultHigh, | ||
types: typesHigh | ||
types: edgeTypes && typesHigh | ||
} : null]; | ||
@@ -221,0 +206,0 @@ } |
@@ -16,3 +16,3 @@ export function push(target, source) { | ||
if (isDuplicate) { | ||
return; | ||
return false; | ||
} | ||
@@ -24,2 +24,4 @@ } | ||
} | ||
return true; | ||
} | ||
@@ -26,0 +28,0 @@ export function copy(target, source) { |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "3.2.0-alpha.4", | ||
"version": "3.2.0-alpha.5", | ||
"keywords": [ | ||
@@ -31,3 +31,3 @@ "webgl", | ||
}, | ||
"gitHead": "92417c40480d10a9e933459ca838df13a34e48a1" | ||
"gitHead": "8e69fa95c79af82f0dc428a480be40c21842caee" | ||
} |
@@ -1,2 +0,2 @@ | ||
/* eslint-disable max-statements, max-depth, complexity */ | ||
/* eslint-disable max-statements, max-depth, complexity, no-unused-expressions */ | ||
import {bitCode, intersect} from './lineclip'; | ||
@@ -135,4 +135,4 @@ import {getPointAtIndex, copy, push} from './utils'; | ||
const resultHigh = []; | ||
const typesLow = edgeTypes && []; | ||
const typesHigh = edgeTypes && []; | ||
const typesLow = []; | ||
const typesHigh = []; | ||
const scratchPoint = []; | ||
@@ -157,32 +157,19 @@ | ||
intersect(prev, p, edge, bbox, scratchPoint); | ||
push(resultLow, scratchPoint); | ||
push(resultHigh, scratchPoint); | ||
if (edgeTypes) { | ||
typesLow.push(prevType); | ||
typesHigh.push(prevType); | ||
} | ||
push(resultLow, scratchPoint) && typesLow.push(prevType); | ||
push(resultHigh, scratchPoint) && typesHigh.push(prevType); | ||
} | ||
if (side <= 0) { | ||
push(resultLow, p); | ||
push(resultLow, p) && typesLow.push(type); | ||
lowPointCount -= side; | ||
} else if (typesLow.length) { | ||
typesLow[typesLow.length - 1] = TYPE_INSIDE; | ||
} | ||
if (side >= 0) { | ||
push(resultHigh, p); | ||
push(resultHigh, p) && typesHigh.push(type); | ||
highPointCount += side; | ||
} else if (typesHigh.length) { | ||
typesHigh[typesHigh.length - 1] = TYPE_INSIDE; | ||
} | ||
if (edgeTypes) { | ||
if (side <= 0) { | ||
typesLow.push(type); | ||
} else if (typesLow.length) { | ||
typesLow[typesLow.length - 1] = TYPE_INSIDE; | ||
} | ||
if (side >= 0) { | ||
typesHigh.push(type); | ||
} else if (typesHigh.length) { | ||
typesHigh[typesHigh.length - 1] = TYPE_INSIDE; | ||
} | ||
} | ||
copy(prev, p); | ||
@@ -194,4 +181,4 @@ prevSide = side; | ||
return [ | ||
lowPointCount ? {pos: resultLow, types: typesLow} : null, | ||
highPointCount ? {pos: resultHigh, types: typesHigh} : null | ||
lowPointCount ? {pos: resultLow, types: edgeTypes && typesLow} : null, | ||
highPointCount ? {pos: resultHigh, types: edgeTypes && typesHigh} : null | ||
]; | ||
@@ -198,0 +185,0 @@ } |
@@ -15,3 +15,3 @@ export function push(target, source) { | ||
if (isDuplicate) { | ||
return; | ||
return false; | ||
} | ||
@@ -23,2 +23,3 @@ } | ||
} | ||
return true; | ||
} | ||
@@ -25,0 +26,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
224008
-0.52%2574
-1.68%