@math.gl/polygon
Advanced tools
Comparing version 3.5.0-alpha.1 to 3.5.0-beta.1
@@ -13,3 +13,3 @@ "use strict"; | ||
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } | ||
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } | ||
@@ -16,0 +16,0 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } |
@@ -22,3 +22,3 @@ import {NumberArray} from '@math.gl/core/'; | ||
// Segment visitor callback type for polygons defined with array of points. | ||
type SegmentVisitorPoints = (p1: NumberArray, p2: NumberArray, i1: number, i2: number) => void; | ||
export type SegmentVisitorPoints = (p1: NumberArray, p2: NumberArray, i1: number, i2: number) => void; | ||
@@ -25,0 +25,0 @@ // Parameters of a polygon. |
import { bitCode, intersect } from './lineclip'; | ||
import { getPointAtIndex, copy, push } from './utils'; | ||
export function cutPolylineByGrid(positions) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var _options$size = options.size, | ||
size = _options$size === void 0 ? 2 : _options$size, | ||
_options$broken = options.broken, | ||
broken = _options$broken === void 0 ? false : _options$broken, | ||
_options$gridResoluti = options.gridResolution, | ||
gridResolution = _options$gridResoluti === void 0 ? 10 : _options$gridResoluti, | ||
_options$gridOffset = options.gridOffset, | ||
gridOffset = _options$gridOffset === void 0 ? [0, 0] : _options$gridOffset, | ||
_options$startIndex = options.startIndex, | ||
startIndex = _options$startIndex === void 0 ? 0 : _options$startIndex, | ||
_options$endIndex = options.endIndex, | ||
endIndex = _options$endIndex === void 0 ? positions.length : _options$endIndex; | ||
var numPoints = (endIndex - startIndex) / size; | ||
var part = []; | ||
var result = [part]; | ||
var a = getPointAtIndex(positions, 0, size, startIndex); | ||
var b; | ||
var codeB; | ||
var cell = getGridCell(a, gridResolution, gridOffset, []); | ||
var scratchPoint = []; | ||
export function cutPolylineByGrid(positions, options = {}) { | ||
const { | ||
size = 2, | ||
broken = false, | ||
gridResolution = 10, | ||
gridOffset = [0, 0], | ||
startIndex = 0, | ||
endIndex = positions.length | ||
} = options; | ||
const numPoints = (endIndex - startIndex) / size; | ||
let part = []; | ||
const result = [part]; | ||
const a = getPointAtIndex(positions, 0, size, startIndex); | ||
let b; | ||
let codeB; | ||
const cell = getGridCell(a, gridResolution, gridOffset, []); | ||
const scratchPoint = []; | ||
push(part, a); | ||
for (var i = 1; i < numPoints; i++) { | ||
for (let i = 1; i < numPoints; i++) { | ||
b = getPointAtIndex(positions, i, size, startIndex, b); | ||
@@ -33,3 +28,3 @@ codeB = bitCode(b, cell); | ||
intersect(a, b, codeB, cell, scratchPoint); | ||
var codeAlt = bitCode(scratchPoint, cell); | ||
const codeAlt = bitCode(scratchPoint, cell); | ||
@@ -60,7 +55,7 @@ if (codeAlt) { | ||
} | ||
var TYPE_INSIDE = 0; | ||
var TYPE_BORDER = 1; | ||
const TYPE_INSIDE = 0; | ||
const TYPE_BORDER = 1; | ||
function concatInPlace(arr1, arr2) { | ||
for (var i = 0; i < arr2.length; i++) { | ||
for (let i = 0; i < arr2.length; i++) { | ||
arr1.push(arr2[i]); | ||
@@ -72,5 +67,3 @@ } | ||
export function cutPolygonByGrid(positions, holeIndices) { | ||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
export function cutPolygonByGrid(positions, holeIndices, options = {}) { | ||
if (!positions.length) { | ||
@@ -80,12 +73,10 @@ return []; | ||
var _options$size2 = options.size, | ||
size = _options$size2 === void 0 ? 2 : _options$size2, | ||
_options$gridResoluti2 = options.gridResolution, | ||
gridResolution = _options$gridResoluti2 === void 0 ? 10 : _options$gridResoluti2, | ||
_options$gridOffset2 = options.gridOffset, | ||
gridOffset = _options$gridOffset2 === void 0 ? [0, 0] : _options$gridOffset2, | ||
_options$edgeTypes = options.edgeTypes, | ||
edgeTypes = _options$edgeTypes === void 0 ? false : _options$edgeTypes; | ||
var result = []; | ||
var queue = [{ | ||
const { | ||
size = 2, | ||
gridResolution = 10, | ||
gridOffset = [0, 0], | ||
edgeTypes = false | ||
} = options; | ||
const result = []; | ||
const queue = [{ | ||
pos: positions, | ||
@@ -95,18 +86,18 @@ types: edgeTypes && new Array(positions.length / size).fill(TYPE_BORDER), | ||
}]; | ||
var bbox = [[], []]; | ||
var cell = []; | ||
const bbox = [[], []]; | ||
let cell = []; | ||
while (queue.length) { | ||
var _queue$shift = queue.shift(), | ||
pos = _queue$shift.pos, | ||
types = _queue$shift.types, | ||
holes = _queue$shift.holes; | ||
const { | ||
pos, | ||
types, | ||
holes | ||
} = queue.shift(); | ||
getBoundingBox(pos, size, holes[0] || pos.length, bbox); | ||
cell = getGridCell(bbox[0], gridResolution, gridOffset, cell); | ||
var code = bitCode(bbox[1], cell); | ||
const code = bitCode(bbox[1], cell); | ||
if (code) { | ||
var parts = bisectPolygon(pos, types, size, 0, holes[0] || pos.length, cell, code); | ||
var polygonLow = { | ||
let parts = bisectPolygon(pos, types, size, 0, holes[0] || pos.length, cell, code); | ||
const polygonLow = { | ||
pos: parts[0].pos, | ||
@@ -116,3 +107,3 @@ types: parts[0].types, | ||
}; | ||
var polygonHigh = { | ||
const polygonHigh = { | ||
pos: parts[1].pos, | ||
@@ -124,3 +115,3 @@ types: parts[1].types, | ||
for (var i = 0; i < holes.length; i++) { | ||
for (let i = 0; i < holes.length; i++) { | ||
parts = bisectPolygon(pos, types, size, holes[i], holes[i + 1] || pos.length, cell, code); | ||
@@ -147,3 +138,3 @@ | ||
} else { | ||
var polygon = { | ||
const polygon = { | ||
positions: pos | ||
@@ -168,18 +159,18 @@ }; | ||
function bisectPolygon(positions, edgeTypes, size, startIndex, endIndex, bbox, edge) { | ||
var numPoints = (endIndex - startIndex) / size; | ||
var resultLow = []; | ||
var resultHigh = []; | ||
var typesLow = []; | ||
var typesHigh = []; | ||
var scratchPoint = []; | ||
var p; | ||
var side; | ||
var type; | ||
var prev = getPointAtIndex(positions, numPoints - 1, size, startIndex); | ||
var prevSide = Math.sign(edge & 8 ? prev[1] - bbox[3] : prev[0] - bbox[2]); | ||
var prevType = edgeTypes && edgeTypes[numPoints - 1]; | ||
var lowPointCount = 0; | ||
var highPointCount = 0; | ||
const numPoints = (endIndex - startIndex) / size; | ||
const resultLow = []; | ||
const resultHigh = []; | ||
const typesLow = []; | ||
const typesHigh = []; | ||
const scratchPoint = []; | ||
let p; | ||
let side; | ||
let type; | ||
const prev = getPointAtIndex(positions, numPoints - 1, size, startIndex); | ||
let prevSide = Math.sign(edge & 8 ? prev[1] - bbox[3] : prev[0] - bbox[2]); | ||
let prevType = edgeTypes && edgeTypes[numPoints - 1]; | ||
let lowPointCount = 0; | ||
let highPointCount = 0; | ||
for (var i = 0; i < numPoints; i++) { | ||
for (let i = 0; i < numPoints; i++) { | ||
p = getPointAtIndex(positions, i, size, startIndex, p); | ||
@@ -224,4 +215,4 @@ side = Math.sign(edge & 8 ? p[1] - bbox[3] : p[0] - bbox[2]); | ||
function getGridCell(p, gridResolution, gridOffset, out) { | ||
var left = Math.floor((p[0] - gridOffset[0]) / gridResolution) * gridResolution + gridOffset[0]; | ||
var bottom = Math.floor((p[1] - gridOffset[1]) / gridResolution) * gridResolution + gridOffset[1]; | ||
const left = Math.floor((p[0] - gridOffset[0]) / gridResolution) * gridResolution + gridOffset[0]; | ||
const bottom = Math.floor((p[1] - gridOffset[1]) / gridResolution) * gridResolution + gridOffset[1]; | ||
out[0] = left; | ||
@@ -251,10 +242,10 @@ out[1] = bottom; | ||
function getBoundingBox(positions, size, endIndex, out) { | ||
var minX = Infinity; | ||
var maxX = -Infinity; | ||
var minY = Infinity; | ||
var maxY = -Infinity; | ||
let minX = Infinity; | ||
let maxX = -Infinity; | ||
let minY = Infinity; | ||
let maxY = -Infinity; | ||
for (var i = 0; i < endIndex; i += size) { | ||
var x = positions[i]; | ||
var y = positions[i + 1]; | ||
for (let i = 0; i < endIndex; i += size) { | ||
const x = positions[i]; | ||
const y = positions[i + 1]; | ||
minX = x < minX ? x : minX; | ||
@@ -261,0 +252,0 @@ maxX = x > maxX ? x : maxX; |
@@ -1,24 +0,15 @@ | ||
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
import { cutPolylineByGrid, cutPolygonByGrid } from './cut-by-grid'; | ||
import { getPointAtIndex, push } from './utils'; | ||
var DEFAULT_MAX_LATITUDE = 85.051129; | ||
export function cutPolylineByMercatorBounds(positions) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var _options$size = options.size, | ||
size = _options$size === void 0 ? 2 : _options$size, | ||
_options$startIndex = options.startIndex, | ||
startIndex = _options$startIndex === void 0 ? 0 : _options$startIndex, | ||
_options$endIndex = options.endIndex, | ||
endIndex = _options$endIndex === void 0 ? positions.length : _options$endIndex, | ||
_options$normalize = options.normalize, | ||
normalize = _options$normalize === void 0 ? true : _options$normalize; | ||
var newPositions = positions.slice(startIndex, endIndex); | ||
const DEFAULT_MAX_LATITUDE = 85.051129; | ||
export function cutPolylineByMercatorBounds(positions, options = {}) { | ||
const { | ||
size = 2, | ||
startIndex = 0, | ||
endIndex = positions.length, | ||
normalize = true | ||
} = options; | ||
const newPositions = positions.slice(startIndex, endIndex); | ||
wrapLongitudesForShortestPath(newPositions, size, 0, endIndex - startIndex); | ||
var parts = cutPolylineByGrid(newPositions, { | ||
size: size, | ||
const parts = cutPolylineByGrid(newPositions, { | ||
size, | ||
broken: true, | ||
@@ -30,14 +21,4 @@ gridResolution: 360, | ||
if (normalize) { | ||
var _iterator = _createForOfIteratorHelper(parts), | ||
_step; | ||
try { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var part = _step.value; | ||
shiftLongitudesIntoRange(part, size); | ||
} | ||
} catch (err) { | ||
_iterator.e(err); | ||
} finally { | ||
_iterator.f(); | ||
for (const part of parts) { | ||
shiftLongitudesIntoRange(part, size); | ||
} | ||
@@ -48,27 +29,25 @@ } | ||
} | ||
export function cutPolygonByMercatorBounds(positions, holeIndices) { | ||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var _options$size2 = options.size, | ||
size = _options$size2 === void 0 ? 2 : _options$size2, | ||
_options$normalize2 = options.normalize, | ||
normalize = _options$normalize2 === void 0 ? true : _options$normalize2, | ||
_options$edgeTypes = options.edgeTypes, | ||
edgeTypes = _options$edgeTypes === void 0 ? false : _options$edgeTypes; | ||
export function cutPolygonByMercatorBounds(positions, holeIndices, options = {}) { | ||
const { | ||
size = 2, | ||
normalize = true, | ||
edgeTypes = false | ||
} = options; | ||
holeIndices = holeIndices || []; | ||
var newPositions = []; | ||
var newHoleIndices = []; | ||
var srcStartIndex = 0; | ||
var targetIndex = 0; | ||
const newPositions = []; | ||
const newHoleIndices = []; | ||
let srcStartIndex = 0; | ||
let targetIndex = 0; | ||
for (var ringIndex = 0; ringIndex <= holeIndices.length; ringIndex++) { | ||
var srcEndIndex = holeIndices[ringIndex] || positions.length; | ||
var targetStartIndex = targetIndex; | ||
var splitIndex = findSplitIndex(positions, size, srcStartIndex, srcEndIndex); | ||
for (let ringIndex = 0; ringIndex <= holeIndices.length; ringIndex++) { | ||
const srcEndIndex = holeIndices[ringIndex] || positions.length; | ||
const targetStartIndex = targetIndex; | ||
const splitIndex = findSplitIndex(positions, size, srcStartIndex, srcEndIndex); | ||
for (var i = splitIndex; i < srcEndIndex; i++) { | ||
for (let i = splitIndex; i < srcEndIndex; i++) { | ||
newPositions[targetIndex++] = positions[i]; | ||
} | ||
for (var _i = srcStartIndex; _i < splitIndex; _i++) { | ||
newPositions[targetIndex++] = positions[_i]; | ||
for (let i = srcStartIndex; i < splitIndex; i++) { | ||
newPositions[targetIndex++] = positions[i]; | ||
} | ||
@@ -83,22 +62,12 @@ | ||
newHoleIndices.pop(); | ||
var parts = cutPolygonByGrid(newPositions, newHoleIndices, { | ||
size: size, | ||
const parts = cutPolygonByGrid(newPositions, newHoleIndices, { | ||
size, | ||
gridResolution: 360, | ||
gridOffset: [-180, -180], | ||
edgeTypes: edgeTypes | ||
edgeTypes | ||
}); | ||
if (normalize) { | ||
var _iterator2 = _createForOfIteratorHelper(parts), | ||
_step2; | ||
try { | ||
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { | ||
var part = _step2.value; | ||
shiftLongitudesIntoRange(part.positions, size); | ||
} | ||
} catch (err) { | ||
_iterator2.e(err); | ||
} finally { | ||
_iterator2.f(); | ||
for (const part of parts) { | ||
shiftLongitudesIntoRange(part.positions, size); | ||
} | ||
@@ -111,7 +80,7 @@ } | ||
function findSplitIndex(positions, size, startIndex, endIndex) { | ||
var maxLat = -1; | ||
var pointIndex = -1; | ||
let maxLat = -1; | ||
let pointIndex = -1; | ||
for (var i = startIndex + 1; i < endIndex; i += size) { | ||
var lat = Math.abs(positions[i]); | ||
for (let i = startIndex + 1; i < endIndex; i += size) { | ||
const lat = Math.abs(positions[i]); | ||
@@ -127,9 +96,8 @@ if (lat > maxLat) { | ||
function insertPoleVertices(positions, size, startIndex, endIndex) { | ||
var maxLatitude = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : DEFAULT_MAX_LATITUDE; | ||
var firstLng = positions[startIndex]; | ||
var lastLng = positions[endIndex - size]; | ||
function insertPoleVertices(positions, size, startIndex, endIndex, maxLatitude = DEFAULT_MAX_LATITUDE) { | ||
const firstLng = positions[startIndex]; | ||
const lastLng = positions[endIndex - size]; | ||
if (Math.abs(firstLng - lastLng) > 180) { | ||
var p = getPointAtIndex(positions, 0, size, startIndex); | ||
const p = getPointAtIndex(positions, 0, size, startIndex); | ||
p[0] += Math.round((lastLng - firstLng) / 360) * 360; | ||
@@ -145,8 +113,8 @@ push(positions, p); | ||
function wrapLongitudesForShortestPath(positions, size, startIndex, endIndex) { | ||
var prevLng = positions[0]; | ||
var lng; | ||
let prevLng = positions[0]; | ||
let lng; | ||
for (var i = startIndex; i < endIndex; i += size) { | ||
for (let i = startIndex; i < endIndex; i += size) { | ||
lng = positions[i]; | ||
var delta = lng - prevLng; | ||
const delta = lng - prevLng; | ||
@@ -162,6 +130,6 @@ if (delta > 180 || delta < -180) { | ||
function shiftLongitudesIntoRange(positions, size) { | ||
var refLng; | ||
var pointCount = positions.length / size; | ||
let refLng; | ||
const pointCount = positions.length / size; | ||
for (var i = 0; i < pointCount; i++) { | ||
for (let i = 0; i < pointCount; i++) { | ||
refLng = positions[i * size]; | ||
@@ -174,3 +142,3 @@ | ||
var delta = -Math.round(refLng / 360) * 360; | ||
const delta = -Math.round(refLng / 360) * 360; | ||
@@ -181,6 +149,6 @@ if (delta === 0) { | ||
for (var _i2 = 0; _i2 < pointCount; _i2++) { | ||
positions[_i2 * size] += delta; | ||
for (let i = 0; i < pointCount; i++) { | ||
positions[i * size] += delta; | ||
} | ||
} | ||
//# sourceMappingURL=cut-by-mercator-bounds.js.map |
import { getPolygonSignedArea } from './polygon-utils'; | ||
export function earcut(data, holeIndices, dim, areas) { | ||
dim = dim || 2; | ||
var hasHoles = holeIndices && holeIndices.length; | ||
var outerLen = hasHoles ? holeIndices[0] * dim : data.length; | ||
var outerNode = linkedList(data, 0, outerLen, dim, true, areas && areas[0]); | ||
var triangles = []; | ||
const hasHoles = holeIndices && holeIndices.length; | ||
const outerLen = hasHoles ? holeIndices[0] * dim : data.length; | ||
let outerNode = linkedList(data, 0, outerLen, dim, true, areas && areas[0]); | ||
const triangles = []; | ||
if (!outerNode || outerNode.next === outerNode.prev) return triangles; | ||
var invSize; | ||
var maxX; | ||
var maxY; | ||
var minX; | ||
var minY; | ||
var x; | ||
var y; | ||
let invSize; | ||
let maxX; | ||
let maxY; | ||
let minX; | ||
let minY; | ||
let x; | ||
let y; | ||
if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim, areas); | ||
@@ -22,3 +22,3 @@ | ||
for (var i = dim; i < outerLen; i += dim) { | ||
for (let i = dim; i < outerLen; i += dim) { | ||
x = data[i]; | ||
@@ -41,9 +41,9 @@ y = data[i + 1]; | ||
function linkedList(data, start, end, dim, clockwise, area) { | ||
var i; | ||
var last; | ||
let i; | ||
let last; | ||
if (area === undefined) { | ||
area = getPolygonSignedArea(data, { | ||
start: start, | ||
end: end, | ||
start, | ||
end, | ||
size: dim | ||
@@ -54,9 +54,5 @@ }); | ||
if (clockwise === area < 0) { | ||
for (i = start; i < end; i += dim) { | ||
last = insertNode(i, data[i], data[i + 1], last); | ||
} | ||
for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last); | ||
} else { | ||
for (i = end - dim; i >= start; i -= dim) { | ||
last = insertNode(i, data[i], data[i + 1], last); | ||
} | ||
for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last); | ||
} | ||
@@ -75,4 +71,4 @@ | ||
if (!end) end = start; | ||
var p = start; | ||
var again; | ||
let p = start; | ||
let again; | ||
@@ -98,5 +94,5 @@ do { | ||
if (!pass && invSize) indexCurve(ear, minX, minY, invSize); | ||
var stop = ear; | ||
var prev; | ||
var next; | ||
let stop = ear; | ||
let prev; | ||
let next; | ||
@@ -135,7 +131,7 @@ while (ear.prev !== ear.next) { | ||
function isEar(ear) { | ||
var a = ear.prev; | ||
var b = ear; | ||
var c = ear.next; | ||
const a = ear.prev; | ||
const b = ear; | ||
const c = ear.next; | ||
if (area(a, b, c) >= 0) return false; | ||
var p = ear.next.next; | ||
let p = ear.next.next; | ||
@@ -151,14 +147,14 @@ while (p !== ear.prev) { | ||
function isEarHashed(ear, minX, minY, invSize) { | ||
var a = ear.prev; | ||
var b = ear; | ||
var c = ear.next; | ||
const a = ear.prev; | ||
const b = ear; | ||
const c = ear.next; | ||
if (area(a, b, c) >= 0) return false; | ||
var minTX = a.x < b.x ? a.x < c.x ? a.x : c.x : b.x < c.x ? b.x : c.x; | ||
var minTY = a.y < b.y ? a.y < c.y ? a.y : c.y : b.y < c.y ? b.y : c.y; | ||
var maxTX = a.x > b.x ? a.x > c.x ? a.x : c.x : b.x > c.x ? b.x : c.x; | ||
var maxTY = a.y > b.y ? a.y > c.y ? a.y : c.y : b.y > c.y ? b.y : c.y; | ||
var minZ = zOrder(minTX, minTY, minX, minY, invSize); | ||
var maxZ = zOrder(maxTX, maxTY, minX, minY, invSize); | ||
var p = ear.prevZ; | ||
var n = ear.nextZ; | ||
const minTX = a.x < b.x ? a.x < c.x ? a.x : c.x : b.x < c.x ? b.x : c.x; | ||
const minTY = a.y < b.y ? a.y < c.y ? a.y : c.y : b.y < c.y ? b.y : c.y; | ||
const maxTX = a.x > b.x ? a.x > c.x ? a.x : c.x : b.x > c.x ? b.x : c.x; | ||
const maxTY = a.y > b.y ? a.y > c.y ? a.y : c.y : b.y > c.y ? b.y : c.y; | ||
const minZ = zOrder(minTX, minTY, minX, minY, invSize); | ||
const maxZ = zOrder(maxTX, maxTY, minX, minY, invSize); | ||
let p = ear.prevZ; | ||
let n = ear.nextZ; | ||
@@ -186,7 +182,7 @@ while (p && p.z >= minZ && n && n.z <= maxZ) { | ||
function cureLocalIntersections(start, triangles, dim) { | ||
var p = start; | ||
let p = start; | ||
do { | ||
var a = p.prev; | ||
var b = p.next.next; | ||
const a = p.prev; | ||
const b = p.next.next; | ||
@@ -209,10 +205,10 @@ if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { | ||
function splitEarcut(start, triangles, dim, minX, minY, invSize) { | ||
var a = start; | ||
let a = start; | ||
do { | ||
var b = a.next.next; | ||
let b = a.next.next; | ||
while (b !== a.prev) { | ||
if (a.i !== b.i && isValidDiagonal(a, b)) { | ||
var c = splitPolygon(a, b); | ||
let c = splitPolygon(a, b); | ||
a = filterPoints(a, a.next); | ||
@@ -233,8 +229,8 @@ c = filterPoints(c, c.next); | ||
function eliminateHoles(data, holeIndices, outerNode, dim, areas) { | ||
var queue = []; | ||
var i; | ||
var len; | ||
var start; | ||
var end; | ||
var list; | ||
const queue = []; | ||
let i; | ||
let len; | ||
let start; | ||
let end; | ||
let list; | ||
@@ -267,3 +263,3 @@ for (i = 0, len = holeIndices.length; i < len; i++) { | ||
if (outerNode) { | ||
var b = splitPolygon(outerNode, hole); | ||
const b = splitPolygon(outerNode, hole); | ||
filterPoints(outerNode, outerNode.next); | ||
@@ -275,11 +271,11 @@ filterPoints(b, b.next); | ||
function findHoleBridge(hole, outerNode) { | ||
var p = outerNode; | ||
var hx = hole.x; | ||
var hy = hole.y; | ||
var qx = -Infinity; | ||
var m; | ||
let p = outerNode; | ||
const hx = hole.x; | ||
const hy = hole.y; | ||
let qx = -Infinity; | ||
let m; | ||
do { | ||
if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { | ||
var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); | ||
const x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); | ||
@@ -303,7 +299,7 @@ if (x <= hx && x > qx) { | ||
if (hx === qx) return m; | ||
var stop = m; | ||
var mx = m.x; | ||
var my = m.y; | ||
var tanMin = Infinity; | ||
var tan; | ||
const stop = m; | ||
const mx = m.x; | ||
const my = m.y; | ||
let tanMin = Infinity; | ||
let tan; | ||
p = m; | ||
@@ -332,3 +328,3 @@ | ||
function indexCurve(start, minX, minY, invSize) { | ||
var p = start; | ||
let p = start; | ||
@@ -348,11 +344,11 @@ do { | ||
function sortLinked(list) { | ||
var e; | ||
var i; | ||
var inSize = 1; | ||
var numMerges; | ||
var p; | ||
var pSize; | ||
var q; | ||
var qSize; | ||
var tail; | ||
let e; | ||
let i; | ||
let inSize = 1; | ||
let numMerges; | ||
let p; | ||
let pSize; | ||
let q; | ||
let qSize; | ||
let tail; | ||
@@ -419,4 +415,4 @@ do { | ||
function getLeftmost(start) { | ||
var p = start; | ||
var leftmost = start; | ||
let p = start; | ||
let leftmost = start; | ||
@@ -448,6 +444,6 @@ do { | ||
function intersects(p1, q1, p2, q2) { | ||
var o1 = sign(area(p1, q1, p2)); | ||
var o2 = sign(area(p1, q1, q2)); | ||
var o3 = sign(area(p2, q2, p1)); | ||
var o4 = sign(area(p2, q2, q1)); | ||
const o1 = sign(area(p1, q1, p2)); | ||
const o2 = sign(area(p1, q1, q2)); | ||
const o3 = sign(area(p2, q2, p1)); | ||
const o4 = sign(area(p2, q2, q1)); | ||
if (o1 !== o2 && o3 !== o4) return true; | ||
@@ -470,3 +466,3 @@ if (o1 === 0 && onSegment(p1, p2, q1)) return true; | ||
function intersectsPolygon(a, b) { | ||
var p = a; | ||
let p = a; | ||
@@ -486,6 +482,6 @@ do { | ||
function middleInside(a, b) { | ||
var p = a; | ||
var inside = false; | ||
var px = (a.x + b.x) / 2; | ||
var py = (a.y + b.y) / 2; | ||
let p = a; | ||
let inside = false; | ||
const px = (a.x + b.x) / 2; | ||
const py = (a.y + b.y) / 2; | ||
@@ -501,6 +497,6 @@ do { | ||
function splitPolygon(a, b) { | ||
var a2 = new Node(a.i, a.x, a.y); | ||
var b2 = new Node(b.i, b.x, b.y); | ||
var an = a.next; | ||
var bp = b.prev; | ||
const a2 = new Node(a.i, a.x, a.y); | ||
const b2 = new Node(b.i, b.x, b.y); | ||
const an = a.next; | ||
const bp = b.prev; | ||
a.next = b; | ||
@@ -518,3 +514,3 @@ b.prev = a; | ||
function insertNode(i, x, y, last) { | ||
var p = new Node(i, x, y); | ||
const p = new Node(i, x, y); | ||
@@ -521,0 +517,0 @@ if (!last) { |
import { push, copy, getPointAtIndex } from './utils'; | ||
export function clipPolyline(positions, bbox) { | ||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var _options$size = options.size, | ||
size = _options$size === void 0 ? 2 : _options$size, | ||
_options$startIndex = options.startIndex, | ||
startIndex = _options$startIndex === void 0 ? 0 : _options$startIndex, | ||
_options$endIndex = options.endIndex, | ||
endIndex = _options$endIndex === void 0 ? positions.length : _options$endIndex; | ||
var numPoints = (endIndex - startIndex) / size; | ||
var result = []; | ||
var part = []; | ||
var a; | ||
var b; | ||
var codeA = -1; | ||
var codeB; | ||
var lastCode; | ||
export function clipPolyline(positions, bbox, options = {}) { | ||
const { | ||
size = 2, | ||
startIndex = 0, | ||
endIndex = positions.length | ||
} = options; | ||
const numPoints = (endIndex - startIndex) / size; | ||
const result = []; | ||
let part = []; | ||
let a; | ||
let b; | ||
let codeA = -1; | ||
let codeB; | ||
let lastCode; | ||
for (var i = 1; i < numPoints; i++) { | ||
for (let i = 1; i < numPoints; i++) { | ||
a = getPointAtIndex(positions, i - 1, size, startIndex, a); | ||
@@ -62,18 +60,18 @@ b = getPointAtIndex(positions, i, size, startIndex, b); | ||
} | ||
export function clipPolygon(positions, bbox) { | ||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var _options$size2 = options.size, | ||
size = _options$size2 === void 0 ? 2 : _options$size2, | ||
_options$endIndex2 = options.endIndex, | ||
endIndex = _options$endIndex2 === void 0 ? positions.length : _options$endIndex2; | ||
var _options$startIndex2 = options.startIndex, | ||
startIndex = _options$startIndex2 === void 0 ? 0 : _options$startIndex2; | ||
var numPoints = (endIndex - startIndex) / size; | ||
var result; | ||
var p; | ||
var prev; | ||
var inside; | ||
var prevInside; | ||
export function clipPolygon(positions, bbox, options = {}) { | ||
const { | ||
size = 2, | ||
endIndex = positions.length | ||
} = options; | ||
let { | ||
startIndex = 0 | ||
} = options; | ||
let numPoints = (endIndex - startIndex) / size; | ||
let result; | ||
let p; | ||
let prev; | ||
let inside; | ||
let prevInside; | ||
for (var edge = 1; edge <= 8; edge *= 2) { | ||
for (let edge = 1; edge <= 8; edge *= 2) { | ||
result = []; | ||
@@ -83,3 +81,3 @@ prev = getPointAtIndex(positions, numPoints - 1, size, startIndex, prev); | ||
for (var i = 0; i < numPoints; i++) { | ||
for (let i = 0; i < numPoints; i++) { | ||
p = getPointAtIndex(positions, i, size, startIndex, p); | ||
@@ -101,6 +99,5 @@ inside = !(bitCode(p, bbox) & edge); | ||
} | ||
export function intersect(a, b, edge, bbox) { | ||
var out = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : []; | ||
var t; | ||
var snap; | ||
export function intersect(a, b, edge, bbox, out = []) { | ||
let t; | ||
let snap; | ||
@@ -123,3 +120,3 @@ if (edge & 8) { | ||
for (var i = 0; i < a.length; i++) { | ||
for (let i = 0; i < a.length; i++) { | ||
out[i] = (snap & 1) === i ? bbox[snap] : t * (b[i] - a[i]) + a[i]; | ||
@@ -131,3 +128,3 @@ } | ||
export function bitCode(p, bbox) { | ||
var code = 0; | ||
let code = 0; | ||
if (p[0] < bbox[0]) code |= 1;else if (p[0] > bbox[2]) code |= 2; | ||
@@ -134,0 +131,0 @@ if (p[1] < bbox[1]) code |= 4;else if (p[1] > bbox[3]) code |= 8; |
@@ -22,3 +22,3 @@ import {NumberArray} from '@math.gl/core/'; | ||
// Segment visitor callback type for polygons defined with array of points. | ||
type SegmentVisitorPoints = (p1: NumberArray, p2: NumberArray, i1: number, i2: number) => void; | ||
export type SegmentVisitorPoints = (p1: NumberArray, p2: NumberArray, i1: number, i2: number) => void; | ||
@@ -25,0 +25,0 @@ // Parameters of a polygon. |
import { equals } from '@math.gl/core'; | ||
export var WINDING = { | ||
export const WINDING = { | ||
CLOCKWISE: 1, | ||
COUNTER_CLOCKWISE: -1 | ||
}; | ||
export function modifyPolygonWindingDirection(points, direction) { | ||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var windingDirection = getPolygonWindingDirection(points, options); | ||
export function modifyPolygonWindingDirection(points, direction, options = {}) { | ||
const windingDirection = getPolygonWindingDirection(points, options); | ||
@@ -17,16 +16,14 @@ if (windingDirection !== direction) { | ||
} | ||
export function getPolygonWindingDirection(points) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
export function getPolygonWindingDirection(points, options = {}) { | ||
return Math.sign(getPolygonSignedArea(points, options)); | ||
} | ||
export function getPolygonSignedArea(points) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var _options$start = options.start, | ||
start = _options$start === void 0 ? 0 : _options$start, | ||
_options$end = options.end, | ||
end = _options$end === void 0 ? points.length : _options$end; | ||
var dim = options.size || 2; | ||
var area = 0; | ||
export function getPolygonSignedArea(points, options = {}) { | ||
const { | ||
start = 0, | ||
end = points.length | ||
} = options; | ||
const dim = options.size || 2; | ||
let area = 0; | ||
for (var i = start, j = end - dim; i < end; i += dim) { | ||
for (let i = start, j = end - dim; i < end; i += dim) { | ||
area += (points[i] - points[j]) * (points[i + 1] + points[j + 1]); | ||
@@ -38,19 +35,17 @@ j = i; | ||
} | ||
export function forEachSegmentInPolygon(points, visitor) { | ||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var _options$start2 = options.start, | ||
start = _options$start2 === void 0 ? 0 : _options$start2, | ||
_options$end2 = options.end, | ||
end = _options$end2 === void 0 ? points.length : _options$end2, | ||
_options$size = options.size, | ||
size = _options$size === void 0 ? 2 : _options$size, | ||
isClosed = options.isClosed; | ||
var numPoints = (end - start) / size; | ||
export function forEachSegmentInPolygon(points, visitor, options = {}) { | ||
const { | ||
start = 0, | ||
end = points.length, | ||
size = 2, | ||
isClosed | ||
} = options; | ||
const numPoints = (end - start) / size; | ||
for (var i = 0; i < numPoints - 1; ++i) { | ||
for (let i = 0; i < numPoints - 1; ++i) { | ||
visitor(points[start + i * size], points[start + i * size + 1], points[start + (i + 1) * size], points[start + (i + 1) * size + 1], i, i + 1); | ||
} | ||
var endPointIndex = start + (numPoints - 1) * size; | ||
var isClosedEx = isClosed || equals(points[start], points[endPointIndex]) && equals(points[start + 1], points[endPointIndex + 1]); | ||
const endPointIndex = start + (numPoints - 1) * size; | ||
const isClosedEx = isClosed || equals(points[start], points[endPointIndex]) && equals(points[start + 1], points[endPointIndex + 1]); | ||
@@ -63,17 +58,16 @@ if (!isClosedEx) { | ||
function reversePolygon(points, options) { | ||
var _options$start3 = options.start, | ||
start = _options$start3 === void 0 ? 0 : _options$start3, | ||
_options$end3 = options.end, | ||
end = _options$end3 === void 0 ? points.length : _options$end3, | ||
_options$size2 = options.size, | ||
size = _options$size2 === void 0 ? 2 : _options$size2; | ||
var numPoints = (end - start) / size; | ||
var numSwaps = Math.floor(numPoints / 2); | ||
const { | ||
start = 0, | ||
end = points.length, | ||
size = 2 | ||
} = options; | ||
const numPoints = (end - start) / size; | ||
const numSwaps = Math.floor(numPoints / 2); | ||
for (var i = 0; i < numSwaps; ++i) { | ||
var b1 = start + i * size; | ||
var b2 = start + (numPoints - 1 - i) * size; | ||
for (let i = 0; i < numSwaps; ++i) { | ||
const b1 = start + i * size; | ||
const b2 = start + (numPoints - 1 - i) * size; | ||
for (var j = 0; j < size; ++j) { | ||
var tmp = points[b1 + j]; | ||
for (let j = 0; j < size; ++j) { | ||
const tmp = points[b1 + j]; | ||
points[b1 + j] = points[b2 + j]; | ||
@@ -85,5 +79,4 @@ points[b2 + j] = tmp; | ||
export function modifyPolygonWindingDirectionPoints(points, direction) { | ||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var currentDirection = getPolygonWindingDirectionPoints(points, options); | ||
export function modifyPolygonWindingDirectionPoints(points, direction, options = {}) { | ||
const currentDirection = getPolygonWindingDirectionPoints(points, options); | ||
@@ -97,15 +90,13 @@ if (currentDirection !== direction) { | ||
} | ||
export function getPolygonWindingDirectionPoints(points) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
export function getPolygonWindingDirectionPoints(points, options = {}) { | ||
return Math.sign(getPolygonSignedAreaPoints(points, options)); | ||
} | ||
export function getPolygonSignedAreaPoints(points) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var _options$start4 = options.start, | ||
start = _options$start4 === void 0 ? 0 : _options$start4, | ||
_options$end4 = options.end, | ||
end = _options$end4 === void 0 ? points.length : _options$end4; | ||
var area = 0; | ||
export function getPolygonSignedAreaPoints(points, options = {}) { | ||
const { | ||
start = 0, | ||
end = points.length | ||
} = options; | ||
let area = 0; | ||
for (var i = start, j = end - 1; i < end; ++i) { | ||
for (let i = start, j = end - 1; i < end; ++i) { | ||
area += (points[i][0] - points[j][0]) * (points[i][1] + points[j][1]); | ||
@@ -117,15 +108,14 @@ j = i; | ||
} | ||
export function forEachSegmentInPolygonPoints(points, visitor) { | ||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var _options$start5 = options.start, | ||
start = _options$start5 === void 0 ? 0 : _options$start5, | ||
_options$end5 = options.end, | ||
end = _options$end5 === void 0 ? points.length : _options$end5, | ||
isClosed = options.isClosed; | ||
export function forEachSegmentInPolygonPoints(points, visitor, options = {}) { | ||
const { | ||
start = 0, | ||
end = points.length, | ||
isClosed | ||
} = options; | ||
for (var i = start; i < end - 1; ++i) { | ||
for (let i = start; i < end - 1; ++i) { | ||
visitor(points[i], points[i + 1], i, i + 1); | ||
} | ||
var isClosedEx = isClosed || equals(points[end - 1], points[0]); | ||
const isClosedEx = isClosed || equals(points[end - 1], points[0]); | ||
@@ -132,0 +122,0 @@ if (!isClosedEx) { |
@@ -1,12 +0,5 @@ | ||
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
import _createClass from "@babel/runtime/helpers/esm/createClass"; | ||
import { isArray } from '@math.gl/core'; | ||
import { getPolygonSignedArea, forEachSegmentInPolygon, modifyPolygonWindingDirection, getPolygonSignedAreaPoints, forEachSegmentInPolygonPoints, modifyPolygonWindingDirectionPoints } from './polygon-utils'; | ||
var Polygon = function () { | ||
function Polygon(points) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
_classCallCheck(this, Polygon); | ||
export default class Polygon { | ||
constructor(points, options = {}) { | ||
this.points = points; | ||
@@ -23,44 +16,34 @@ this.isFlatArray = !isArray(points[0]); | ||
_createClass(Polygon, [{ | ||
key: "getSignedArea", | ||
value: function getSignedArea() { | ||
if (this.isFlatArray) return getPolygonSignedArea(this.points, this.options); | ||
return getPolygonSignedAreaPoints(this.points, this.options); | ||
getSignedArea() { | ||
if (this.isFlatArray) return getPolygonSignedArea(this.points, this.options); | ||
return getPolygonSignedAreaPoints(this.points, this.options); | ||
} | ||
getArea() { | ||
return Math.abs(this.getSignedArea()); | ||
} | ||
getWindingDirection() { | ||
return Math.sign(this.getSignedArea()); | ||
} | ||
forEachSegment(visitor) { | ||
if (this.isFlatArray) { | ||
forEachSegmentInPolygon(this.points, (x1, y1, x2, y2, i1, i2) => { | ||
visitor([x1, y1], [x2, y2], i1, i2); | ||
}, this.options); | ||
} else { | ||
forEachSegmentInPolygonPoints(this.points, visitor, this.options); | ||
} | ||
}, { | ||
key: "getArea", | ||
value: function getArea() { | ||
return Math.abs(this.getSignedArea()); | ||
} | ||
}, { | ||
key: "getWindingDirection", | ||
value: function getWindingDirection() { | ||
return Math.sign(this.getSignedArea()); | ||
} | ||
}, { | ||
key: "forEachSegment", | ||
value: function forEachSegment(visitor) { | ||
if (this.isFlatArray) { | ||
forEachSegmentInPolygon(this.points, function (x1, y1, x2, y2, i1, i2) { | ||
visitor([x1, y1], [x2, y2], i1, i2); | ||
}, this.options); | ||
} else { | ||
forEachSegmentInPolygonPoints(this.points, visitor, this.options); | ||
} | ||
} | ||
}, { | ||
key: "modifyWindingDirection", | ||
value: function modifyWindingDirection(direction) { | ||
if (this.isFlatArray) { | ||
return modifyPolygonWindingDirection(this.points, direction, this.options); | ||
} | ||
} | ||
return modifyPolygonWindingDirectionPoints(this.points, direction, this.options); | ||
modifyWindingDirection(direction) { | ||
if (this.isFlatArray) { | ||
return modifyPolygonWindingDirection(this.points, direction, this.options); | ||
} | ||
}]); | ||
return Polygon; | ||
}(); | ||
return modifyPolygonWindingDirectionPoints(this.points, direction, this.options); | ||
} | ||
export { Polygon as default }; | ||
} | ||
//# sourceMappingURL=polygon.js.map |
export function push(target, source) { | ||
var size = source.length; | ||
var startIndex = target.length; | ||
const size = source.length; | ||
const startIndex = target.length; | ||
if (startIndex > 0) { | ||
var isDuplicate = true; | ||
let isDuplicate = true; | ||
for (var i = 0; i < size; i++) { | ||
for (let i = 0; i < size; i++) { | ||
if (target[startIndex - size + i] !== source[i]) { | ||
@@ -20,4 +20,4 @@ isDuplicate = false; | ||
for (var _i = 0; _i < size; _i++) { | ||
target[startIndex + _i] = source[_i]; | ||
for (let i = 0; i < size; i++) { | ||
target[startIndex + i] = source[i]; | ||
} | ||
@@ -28,13 +28,12 @@ | ||
export function copy(target, source) { | ||
var size = source.length; | ||
const size = source.length; | ||
for (var i = 0; i < size; i++) { | ||
for (let i = 0; i < size; i++) { | ||
target[i] = source[i]; | ||
} | ||
} | ||
export function getPointAtIndex(positions, index, size, offset) { | ||
var out = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : []; | ||
var startI = offset + index * size; | ||
export function getPointAtIndex(positions, index, size, offset, out = []) { | ||
const startI = offset + index * size; | ||
for (var i = 0; i < size; i++) { | ||
for (let i = 0; i < size; i++) { | ||
out[i] = positions[startI + i]; | ||
@@ -41,0 +40,0 @@ } |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "3.5.0-alpha.1", | ||
"version": "3.5.0-beta.1", | ||
"keywords": [ | ||
@@ -28,5 +28,5 @@ "webgl", | ||
"dependencies": { | ||
"@math.gl/core": "3.5.0-alpha.1" | ||
"@math.gl/core": "3.5.0-beta.1" | ||
}, | ||
"gitHead": "d40d72a2b16a54129c9608f2ca326b812903d856" | ||
"gitHead": "193857458219ebd3a605c5c64f3b330ff48dcf02" | ||
} |
@@ -554,4 +554,4 @@ /* | ||
((locallyInside(a, b) && | ||
locallyInside(b, a) && | ||
middleInside(a, b) && // locally visible | ||
locallyInside(b, a) && | ||
middleInside(a, b) && // locally visible | ||
(area(a.prev, a, b.prev) || area(a, b.prev, b))) || // does not create opposite-facing sectors | ||
@@ -558,0 +558,0 @@ (equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0)) |
@@ -22,3 +22,3 @@ import {NumberArray} from '@math.gl/core/'; | ||
// Segment visitor callback type for polygons defined with array of points. | ||
type SegmentVisitorPoints = (p1: NumberArray, p2: NumberArray, i1: number, i2: number) => void; | ||
export type SegmentVisitorPoints = (p1: NumberArray, p2: NumberArray, i1: number, i2: number) => void; | ||
@@ -25,0 +25,0 @@ // Parameters of a polygon. |
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
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61
4265
351869
+ Added@math.gl/core@3.5.0-beta.1(transitive)
- Removed@math.gl/core@3.5.0-alpha.1(transitive)
Updated@math.gl/core@3.5.0-beta.1