Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

three-conic-polygon-geometry

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

three-conic-polygon-geometry - npm Package Compare versions

Comparing version 1.3.4 to 1.3.5

13

dist/three-conic-polygon-geometry.common.js

@@ -155,4 +155,4 @@ 'use strict';

includeSides && addGroup(generateTorso());
closedBottom && addGroup(generateCap(startHeight));
closedTop && addGroup(generateCap(endHeight)); // build geometry
closedBottom && addGroup(generateCap(startHeight, false));
closedTop && addGroup(generateCap(endHeight, true)); // build geometry

@@ -217,4 +217,6 @@ this.setIndex(indices);

function generateCap(radius) {
var isTop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
return {
indices: geoTriangles.indices,
// need to reverse-wind the bottom triangles to make them face outwards
indices: isTop ? geoTriangles.indices : geoTriangles.indices.slice().reverse(),
vertices: generateVertices([geoTriangles.points], radius).vertices

@@ -249,5 +251,6 @@ };

var inds = [0, 1, 2].map(function (idx) {
var inds = [2, 1, 0].map(function (idx) {
return delaunay.triangles[i + idx];
});
}); // reverse wound to have same orientation as earcut
var triangle = inds.map(function (indice) {

@@ -254,0 +257,0 @@ return points[indice];

@@ -1,2 +0,2 @@

// Version 1.3.4 three-conic-polygon-geometry - https://github.com/vasturiano/three-conic-polygon-geometry
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],e):e((t=t||self).THREE=t.THREE||{},t.THREE)}(this,(function(t,e){"use strict";function r(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return r}(t,e)||i(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||i(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}const a=Math.pow(2,-52),s=new Uint32Array(512);class u{static from(t,e=p,r=x){const n=t.length,i=new Float64Array(2*n);for(let o=0;o<n;o++){const n=t[o];i[2*o]=e(n),i[2*o+1]=r(n)}return new u(i)}constructor(t){const e=t.length>>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const r=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*r),this._halfedges=new Int32Array(3*r),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:r,_hullTri:n,_hullHash:i}=this,o=t.length>>1;let s=1/0,u=1/0,f=-1/0,c=-1/0;for(let e=0;e<o;e++){const r=t[2*e],n=t[2*e+1];r<s&&(s=r),n<u&&(u=n),r>f&&(f=r),n>c&&(c=n),this._ids[e]=e}const v=(s+f)/2,p=(u+c)/2;let x,g,m,w=1/0;for(let e=0;e<o;e++){const r=l(v,p,t[2*e],t[2*e+1]);r<w&&(x=e,w=r)}const b=t[2*x],_=t[2*x+1];w=1/0;for(let e=0;e<o;e++){if(e===x)continue;const r=l(b,_,t[2*e],t[2*e+1]);r<w&&r>0&&(g=e,w=r)}let E=t[2*g],M=t[2*g+1],A=1/0;for(let e=0;e<o;e++){if(e===x||e===g)continue;const r=y(b,_,E,M,t[2*e],t[2*e+1]);r<A&&(m=e,A=r)}let P=t[2*m],S=t[2*m+1];if(A===1/0){for(let e=0;e<o;e++)this._dists[e]=t[2*e]-t[0]||t[2*e+1]-t[1];d(this._ids,this._dists,0,o-1);const e=new Uint32Array(o);let r=0;for(let t=0,n=-1/0;t<o;t++){const i=this._ids[t];this._dists[i]>n&&(e[r++]=i,n=this._dists[i])}return this.hull=e.subarray(0,r),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(h(b,_,E,M,P,S)){const t=g,e=E,r=M;g=m,E=P,M=S,m=t,P=e,S=r}const T=function(t,e,r,n,i,o){const a=r-t,s=n-e,u=i-t,l=o-e,f=a*a+s*s,h=u*u+l*l,c=.5/(a*l-s*u);return{x:t+(l*f-s*h)*c,y:e+(a*h-u*f)*c}}(b,_,E,M,P,S);this._cx=T.x,this._cy=T.y;for(let e=0;e<o;e++)this._dists[e]=l(t[2*e],t[2*e+1],T.x,T.y);d(this._ids,this._dists,0,o-1),this._hullStart=x;let R=3;r[x]=e[m]=g,r[g]=e[x]=m,r[m]=e[g]=x,n[x]=0,n[g]=1,n[m]=2,i.fill(-1),i[this._hashKey(b,_)]=x,i[this._hashKey(E,M)]=g,i[this._hashKey(P,S)]=m,this.trianglesLen=0,this._addTriangle(x,g,m,-1,-1,-1);for(let o,s,u=0;u<this._ids.length;u++){const l=this._ids[u],f=t[2*l],c=t[2*l+1];if(u>0&&Math.abs(f-o)<=a&&Math.abs(c-s)<=a)continue;if(o=f,s=c,l===x||l===g||l===m)continue;let y=0;for(let t=0,e=this._hashKey(f,c);t<this._hashSize&&(y=i[(e+t)%this._hashSize],-1===y||y===r[y]);t++);y=e[y];let d,v=y;for(;d=r[v],!h(f,c,t[2*v],t[2*v+1],t[2*d],t[2*d+1]);)if(v=d,v===y){v=-1;break}if(-1===v)continue;let p=this._addTriangle(v,l,r[v],-1,-1,n[v]);n[l]=this._legalize(p+2),n[v]=p,R++;let w=r[v];for(;d=r[w],h(f,c,t[2*w],t[2*w+1],t[2*d],t[2*d+1]);)p=this._addTriangle(w,l,d,n[l],-1,n[w]),n[l]=this._legalize(p+2),r[w]=w,R--,w=d;if(v===y)for(;d=e[v],h(f,c,t[2*d],t[2*d+1],t[2*v],t[2*v+1]);)p=this._addTriangle(d,l,v,-1,n[v],n[d]),this._legalize(p+2),n[d]=p,r[v]=v,R--,v=d;this._hullStart=e[l]=v,r[v]=e[w]=l,r[l]=w,i[this._hashKey(f,c)]=l,i[this._hashKey(t[2*v],t[2*v+1])]=v}this.hull=new Uint32Array(R);for(let t=0,e=this._hullStart;t<R;t++)this.hull[t]=e,e=r[e];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,e){return Math.floor(function(t,e){const r=t/(Math.abs(t)+Math.abs(e));return(e>0?3-r:1+r)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:r,coords:n}=this;let i=0,o=0;for(;;){const a=r[t],u=t-t%3;if(o=u+(t+2)%3,-1===a){if(0===i)break;t=s[--i];continue}const l=a-a%3,f=u+(t+1)%3,h=l+(a+2)%3,y=e[o],d=e[t],v=e[f],p=e[h];if(c(n[2*y],n[2*y+1],n[2*d],n[2*d+1],n[2*v],n[2*v+1],n[2*p],n[2*p+1])){e[t]=p,e[a]=y;const n=r[h];if(-1===n){let e=this._hullStart;do{if(this._hullTri[e]===h){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,n),this._link(a,r[o]),this._link(o,h);const u=l+(a+1)%3;i<s.length&&(s[i++]=u)}else{if(0===i)break;t=s[--i]}}return o}_link(t,e){this._halfedges[t]=e,-1!==e&&(this._halfedges[e]=t)}_addTriangle(t,e,r,n,i,o){const a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=e,this._triangles[a+2]=r,this._link(a,n),this._link(a+1,i),this._link(a+2,o),this.trianglesLen+=3,a}}function l(t,e,r,n){const i=t-r,o=e-n;return i*i+o*o}function f(t,e,r,n,i,o){const a=(n-e)*(i-t),s=(r-t)*(o-e);return Math.abs(a-s)>=33306690738754716e-32*Math.abs(a+s)?a-s:0}function h(t,e,r,n,i,o){return(f(i,o,t,e,r,n)||f(t,e,r,n,i,o)||f(r,n,i,o,t,e))<0}function c(t,e,r,n,i,o,a,s){const u=t-a,l=e-s,f=r-a,h=n-s,c=i-a,y=o-s,d=f*f+h*h,v=c*c+y*y;return u*(h*v-d*y)-l*(f*v-d*c)+(u*u+l*l)*(f*y-h*c)<0}function y(t,e,r,n,i,o){const a=r-t,s=n-e,u=i-t,l=o-e,f=a*a+s*s,h=u*u+l*l,c=.5/(a*l-s*u),y=(l*f-s*h)*c,d=(a*h-u*f)*c;return y*y+d*d}function d(t,e,r,n){if(n-r<=20)for(let i=r+1;i<=n;i++){const n=t[i],o=e[n];let a=i-1;for(;a>=r&&e[t[a]]>o;)t[a+1]=t[a--];t[a+1]=n}else{let i=r+1,o=n;v(t,r+n>>1,i),e[t[r]]>e[t[n]]&&v(t,r,n),e[t[i]]>e[t[n]]&&v(t,i,n),e[t[r]]>e[t[i]]&&v(t,r,i);const a=t[i],s=e[a];for(;;){do{i++}while(e[t[i]]<s);do{o--}while(e[t[o]]>s);if(o<i)break;v(t,i,o)}t[r+1]=t[o],t[o]=a,n-i+1>=o-r?(d(t,e,i,n),d(t,e,r,o-1)):(d(t,e,r,o-1),d(t,e,i,n))}}function v(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function p(t){return t[0]}function x(t){return t[1]}var g=w,m=w;function w(t,e,r){r=r||2;var n,i,o,a,s,u,l,f=e&&e.length,h=f?e[0]*r:t.length,c=b(t,0,h,r,!0),y=[];if(!c||c.next===c.prev)return y;if(f&&(c=function(t,e,r,n){var i,o,a,s,u,l=[];for(i=0,o=e.length;i<o;i++)a=e[i]*n,s=i<o-1?e[i+1]*n:t.length,(u=b(t,a,s,n,!1))===u.next&&(u.steiner=!0),l.push(G(u));for(l.sort(T),i=0;i<l.length;i++)R(l[i],r),r=_(r,r.next);return r}(t,e,c,r)),t.length>80*r){n=o=t[0],i=a=t[1];for(var d=r;d<h;d+=r)(s=t[d])<n&&(n=s),(u=t[d+1])<i&&(i=u),s>o&&(o=s),u>a&&(a=u);l=0!==(l=Math.max(o-n,a-i))?1/l:0}return E(c,y,r,n,i,l),y}function b(t,e,r,n,i){var o,a;if(i===D(t,e,r,n)>0)for(o=e;o<r;o+=n)a=N(o,t[o],t[o+1],a);else for(o=r-n;o>=e;o-=n)a=N(o,t[o],t[o+1],a);return a&&z(a,a.next)&&(H(a),a=a.next),a}function _(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!z(n,n.next)&&0!==I(n.prev,n,n.next))n=n.next;else{if(H(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function E(t,e,r,n,i,o,a){if(t){!a&&o&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=Z(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,o,a,s,u,l=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,n=r,s=0,e=0;e<l&&(s++,n=n.nextZ);e++);for(u=l;s>0||u>0&&n;)0!==s&&(0===u||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,l*=2}while(a>1)}(i)}(t,n,i,o);for(var s,u,l=t;t.prev!==t.next;)if(s=t.prev,u=t.next,o?A(t,n,i,o):M(t))e.push(s.i/r),e.push(t.i/r),e.push(u.i/r),H(t),t=u.next,l=u.next;else if((t=u)===l){a?1===a?E(t=P(_(t),e,r),e,r,n,i,o,2):2===a&&S(t,e,r,n,i,o):E(_(t),e,r,n,i,o,1);break}}}function M(t){var e=t.prev,r=t,n=t.next;if(I(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(k(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&I(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function A(t,e,r,n){var i=t.prev,o=t,a=t.next;if(I(i,o,a)>=0)return!1;for(var s=i.x<o.x?i.x<a.x?i.x:a.x:o.x<a.x?o.x:a.x,u=i.y<o.y?i.y<a.y?i.y:a.y:o.y<a.y?o.y:a.y,l=i.x>o.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,f=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,h=Z(s,u,e,r,n),c=Z(l,f,e,r,n),y=t.prevZ,d=t.nextZ;y&&y.z>=h&&d&&d.z<=c;){if(y!==t.prev&&y!==t.next&&k(i.x,i.y,o.x,o.y,a.x,a.y,y.x,y.y)&&I(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,d!==t.prev&&d!==t.next&&k(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&I(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;y&&y.z>=h;){if(y!==t.prev&&y!==t.next&&k(i.x,i.y,o.x,o.y,a.x,a.y,y.x,y.y)&&I(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;d&&d.z<=c;){if(d!==t.prev&&d!==t.next&&k(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&I(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function P(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!z(i,o)&&C(i,n,n.next,o)&&q(i,o)&&q(o,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(o.i/r),H(n),H(n.next),n=t=o),n=n.next}while(n!==t);return _(n)}function S(t,e,r,n,i,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&O(a,s)){var u=B(a,s);return a=_(a,a.next),u=_(u,u.next),E(a,e,r,n,i,o),void E(u,e,r,n,i,o)}s=s.next}a=a.next}while(a!==t)}function T(t,e){return t.x-e.x}function R(t,e){if(e=function(t,e){var r,n=e,i=t.x,o=t.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>a){if(a=s,s===i){if(o===n.y)return n;if(o===n.next.y)return n.next}r=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!r)return null;if(i===a)return r;var u,l=r,f=r.x,h=r.y,c=1/0;n=r;do{i>=n.x&&n.x>=f&&i!==n.x&&k(o<h?i:a,o,f,h,o<h?a:i,o,n.x,n.y)&&(u=Math.abs(o-n.y)/(i-n.x),q(n,t)&&(u<c||u===c&&(n.x>r.x||n.x===r.x&&F(r,n)))&&(r=n,c=u)),n=n.next}while(n!==l);return r}(t,e)){var r=B(e,t);_(e,e.next),_(r,r.next)}}function F(t,e){return I(t.prev,t,e.prev)<0&&I(e.next,t,t.next)<0}function Z(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function G(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function k(t,e,r,n,i,o,a,s){return(i-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(n-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(i-a)*(n-s)>=0}function O(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&C(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(q(t,e)&&q(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(I(t.prev,t,e.prev)||I(t,e.prev,e))||z(t,e)&&I(t.prev,t,t.next)>0&&I(e.prev,e,e.next)>0)}function I(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function z(t,e){return t.x===e.x&&t.y===e.y}function C(t,e,r,n){var i=L(I(t,e,r)),o=L(I(t,e,n)),a=L(I(r,n,t)),s=L(I(r,n,e));return i!==o&&a!==s||(!(0!==i||!j(t,r,e))||(!(0!==o||!j(t,n,e))||(!(0!==a||!j(r,t,n))||!(0!==s||!j(r,e,n)))))}function j(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function L(t){return t>0?1:t<0?-1:0}function q(t,e){return I(t.prev,t,t.next)<0?I(t,e,t.next)>=0&&I(t,t.prev,e)>=0:I(t,e,t.prev)<0||I(t,t.next,e)<0}function B(t,e){var r=new U(t.i,t.x,t.y),n=new U(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function N(t,e,r,n){var i=new U(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function H(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function U(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function D(t,e,r,n){for(var i=0,o=e,a=r-n;o<r;o+=n)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}function K(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function J(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}w.deviation=function(t,e,r,n){var i=e&&e.length,o=i?e[0]*r:t.length,a=Math.abs(D(t,0,o,r));if(i)for(var s=0,u=e.length;s<u;s++){var l=e[s]*r,f=s<u-1?e[s+1]*r:t.length;a-=Math.abs(D(t,l,f,r))}var h=0;for(s=0;s<n.length;s+=3){var c=n[s]*r,y=n[s+1]*r,d=n[s+2]*r;h+=Math.abs((t[c]-t[d])*(t[y+1]-t[c+1])-(t[c]-t[y])*(t[d+1]-t[c+1]))}return 0===a&&0===h?0:Math.abs((h-a)/a)},w.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var a=0;a<e;a++)r.vertices.push(t[i][o][a]);i>0&&(n+=t[i-1].length,r.holes.push(n))}return r},g.default=m;var V=J((function(t,e){function r(t,e,r){void 0===r&&(r={});var n={type:"Feature"};return(0===r.id||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=e||{},n.geometry=t,n}function n(t,e,n){return void 0===n&&(n={}),r({type:"Point",coordinates:t},e,n)}function i(t,e,n){void 0===n&&(n={});for(var i=0,o=t;i<o.length;i++){var a=o[i];if(a.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<a[a.length-1].length;s++)if(a[a.length-1][s]!==a[0][s])throw new Error("First and last Position are not equivalent.")}return r({type:"Polygon",coordinates:t},e,n)}function o(t,e,n){if(void 0===n&&(n={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return r({type:"LineString",coordinates:t},e,n)}function a(t,e){void 0===e&&(e={});var r={type:"FeatureCollection"};return e.id&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.features=t,r}function s(t,e,n){return void 0===n&&(n={}),r({type:"MultiLineString",coordinates:t},e,n)}function u(t,e,n){return void 0===n&&(n={}),r({type:"MultiPoint",coordinates:t},e,n)}function l(t,e,n){return void 0===n&&(n={}),r({type:"MultiPolygon",coordinates:t},e,n)}function f(t,r){void 0===r&&(r="kilometers");var n=e.factors[r];if(!n)throw new Error(r+" units is invalid");return t*n}function h(t,r){void 0===r&&(r="kilometers");var n=e.factors[r];if(!n)throw new Error(r+" units is invalid");return t/n}function c(t){return 180*(t%(2*Math.PI))/Math.PI}function y(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)&&!/^\s*$/.test(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.earthRadius=6371008.8,e.factors={centimeters:100*e.earthRadius,centimetres:100*e.earthRadius,degrees:e.earthRadius/111325,feet:3.28084*e.earthRadius,inches:39.37*e.earthRadius,kilometers:e.earthRadius/1e3,kilometres:e.earthRadius/1e3,meters:e.earthRadius,metres:e.earthRadius,miles:e.earthRadius/1609.344,millimeters:1e3*e.earthRadius,millimetres:1e3*e.earthRadius,nauticalmiles:e.earthRadius/1852,radians:1,yards:e.earthRadius/1.0936},e.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/e.earthRadius,yards:1/1.0936},e.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046},e.feature=r,e.geometry=function(t,e,r){switch(t){case"Point":return n(e).geometry;case"LineString":return o(e).geometry;case"Polygon":return i(e).geometry;case"MultiPoint":return u(e).geometry;case"MultiLineString":return s(e).geometry;case"MultiPolygon":return l(e).geometry;default:throw new Error(t+" is invalid")}},e.point=n,e.points=function(t,e,r){return void 0===r&&(r={}),a(t.map((function(t){return n(t,e)})),r)},e.polygon=i,e.polygons=function(t,e,r){return void 0===r&&(r={}),a(t.map((function(t){return i(t,e)})),r)},e.lineString=o,e.lineStrings=function(t,e,r){return void 0===r&&(r={}),a(t.map((function(t){return o(t,e)})),r)},e.featureCollection=a,e.multiLineString=s,e.multiPoint=u,e.multiPolygon=l,e.geometryCollection=function(t,e,n){return void 0===n&&(n={}),r({type:"GeometryCollection",geometries:t},e,n)},e.round=function(t,e){if(void 0===e&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r},e.radiansToLength=f,e.lengthToRadians=h,e.lengthToDegrees=function(t,e){return c(h(t,e))},e.bearingToAzimuth=function(t){var e=t%360;return e<0&&(e+=360),e},e.radiansToDegrees=c,e.degreesToRadians=function(t){return t%360*Math.PI/180},e.convertLength=function(t,e,r){if(void 0===e&&(e="kilometers"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return f(h(t,e),r)},e.convertArea=function(t,r,n){if(void 0===r&&(r="meters"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var i=e.areaFactors[r];if(!i)throw new Error("invalid original units");var o=e.areaFactors[n];if(!o)throw new Error("invalid final units");return t/i*o},e.isNumber=y,e.isObject=function(t){return!!t&&t.constructor===Object},e.validateBBox=function(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!y(t))throw new Error("bbox must only contain numbers")}))},e.validateId=function(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")},e.radians2degrees=function(){throw new Error("method has been renamed to `radiansToDegrees`")},e.degrees2radians=function(){throw new Error("method has been renamed to `degreesToRadians`")},e.distanceToDegrees=function(){throw new Error("method has been renamed to `lengthToDegrees`")},e.distanceToRadians=function(){throw new Error("method has been renamed to `lengthToRadians`")},e.radiansToDistance=function(){throw new Error("method has been renamed to `radiansToLength`")},e.bearingToAngle=function(){throw new Error("method has been renamed to `bearingToAzimuth`")},e.convertDistance=function(){throw new Error("method has been renamed to `convertLength`")}})),$=J((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.getCoord=function(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")},e.getCoords=function(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")},e.containsNumber=function t(e){if(e.length>1&&V.isNumber(e[0])&&V.isNumber(e[1]))return!0;if(Array.isArray(e[0])&&e[0].length)return t(e[0]);throw new Error("coordinates must only contain numbers")},e.geojsonType=function(t,e,r){if(!e||!r)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+t.type)},e.featureOf=function(t,e,r){if(!t)throw new Error("No feature passed");if(!r)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+t.geometry.type)},e.collectionOf=function(t,e,r){if(!t)throw new Error("No featureCollection passed");if(!r)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+r+", FeatureCollection required");for(var n=0,i=t.features;n<i.length;n++){var o=i[n];if(!o||"Feature"!==o.type||!o.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+o.geometry.type)}},e.getGeom=function(t){return"Feature"===t.type?t.geometry:t},e.getType=function(t,e){return"FeatureCollection"===t.type?"FeatureCollection":"GeometryCollection"===t.type?"GeometryCollection":"Feature"===t.type&&null!==t.geometry?t.geometry.type:t.type}})),Q=K(J((function(t,e){function r(t,e,r){var n=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var i=0,o=e.length-1;i<e.length;o=i++){var a=e[i][0],s=e[i][1],u=e[o][0],l=e[o][1];if(t[1]*(a-u)+s*(u-t[0])+l*(t[0]-a)==0&&(a-t[0])*(u-t[0])<=0&&(s-t[1])*(l-t[1])<=0)return!r;s>t[1]!=l>t[1]&&t[0]<(u-a)*(t[1]-s)/(l-s)+a&&(n=!n)}return n}Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,n){if(void 0===n&&(n={}),!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var i=$.getCoord(t),o=$.getGeom(e),a=o.type,s=e.bbox,u=o.coordinates;if(s&&!1===function(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}(i,s))return!1;"Polygon"===a&&(u=[u]);for(var l=!1,f=0;f<u.length&&!l;f++)if(r(i,u[f][0],n.ignoreBoundary)){for(var h=!1,c=1;c<u[f].length&&!h;)r(i,u[f][c],!n.ignoreBoundary)&&(h=!0),c++;h||(l=!0)}return l}})));function W(){this.reset()}W.prototype={constructor:W,reset:function(){this.s=this.t=0},add:function(t){Y(X,t,this.t),Y(this,X.s,this.s),this.s?this.t+=X.t:this.s=X.t},valueOf:function(){return this.s}};var X=new W;function Y(t,e,r){var n=t.s=e+r,i=n-e,o=n-i;t.t=e-o+(r-i)}var tt=Math.PI,et=tt/2,rt=180/tt,nt=tt/180,it=Math.abs,ot=Math.atan2,at=Math.cos,st=Math.sin,ut=Math.sqrt;function lt(t){return(t=st(t/2))*t}function ft(){}function ht(t,e){t&&yt.hasOwnProperty(t.type)&&yt[t.type](t,e)}var ct={Feature:function(t,e){ht(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)ht(r[n].geometry,e)}},yt={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)t=r[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){dt(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)dt(r[n],e,0)},Polygon:function(t,e){vt(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)vt(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)ht(r[n],e)}};function dt(t,e,r){var n,i=-1,o=t.length-r;for(e.lineStart();++i<o;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function vt(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)dt(t[r],e,1);e.polygonEnd()}var pt,xt,gt,mt=new W,wt={sphere:ft,point:ft,lineStart:function(){wt.point=_t,wt.lineEnd=bt},lineEnd:ft,polygonStart:ft,polygonEnd:ft};function bt(){wt.point=wt.lineEnd=ft}function _t(t,e){pt=t*=nt,xt=st(e*=nt),gt=at(e),wt.point=Et}function Et(t,e){t*=nt;var r=st(e*=nt),n=at(e),i=it(t-pt),o=at(i),a=n*st(i),s=gt*r-xt*n*o,u=xt*r+gt*n*o;mt.add(ot(ut(a*a+s*s),u)),pt=t,xt=r,gt=n}function Mt(t){return mt.reset(),function(t,e){t&&ct.hasOwnProperty(t.type)?ct[t.type](t,e):ht(t,e)}(t,wt),+mt}var At=[null,null],Pt={type:"LineString",coordinates:At};function St(t,e){var r,n=t[0]*nt,i=t[1]*nt,o=e[0]*nt,a=e[1]*nt,s=at(i),u=st(i),l=at(a),f=st(a),h=s*at(n),c=s*st(n),y=l*at(o),d=l*st(o),v=2*((r=ut(lt(a-i)+s*l*lt(o-n)))>1?et:r<-1?-et:Math.asin(r)),p=st(v),x=v?function(t){var e=st(t*=v)/p,r=st(v-t)/p,n=r*h+e*y,i=r*c+e*d,o=r*u+e*f;return[ot(i,n)*rt,ot(o,ut(n*n+i*i))*rt]}:function(){return[n*rt,i*rt]};return x.distance=v,x}function Tt(t,e){let r,n;if(void 0===e)for(const e of t)null!=e&&(void 0===r?e>=e&&(r=n=e):(r>e&&(r=e),n<e&&(n=e)));else{let i=-1;for(let o of t)null!=(o=e(o,++i,t))&&(void 0===r?o>=o&&(r=n=o):(r>o&&(r=o),n<o&&(n=o)))}return[r,n]}function Rt(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}var Ft=window.THREE?window.THREE:{BufferGeometry:e.BufferGeometry,Float32BufferAttribute:e.Float32BufferAttribute,Geometry:e.Geometry},Zt=(new Ft.BufferGeometry).setAttribute?"setAttribute":"addAttribute";function Gt(t,e,r,n,i,o,a){Ft.Geometry.call(this),this.type="ConicPolygonGeometry",this.parameters={polygonGeoJson:t,startHeight:e,endHeight:r,closedBottom:n,closedTop:i,includeSides:o,curvatureResolution:a},this.fromBufferGeometry(new kt(t,e,r,n,i,o)),this.mergeVertices()}function kt(t,e,i,o,a,s,l){var f=this;Ft.BufferGeometry.call(this),this.type="ConicPolygonBufferGeometry",this.parameters={polygonGeoJson:t,startHeight:e,endHeight:i,closedBottom:o,closedTop:a,includeSides:s,curvatureResolution:l},e=e||0,i=i||1,o=void 0===o||o,a=void 0===a||a,s=void 0===s||s;var h=function(t,e){return t.map((function(t){var r,n=[];return t.forEach((function(t){if(r){var i=180*(u=t,l=r,At[0]=u,At[1]=l,Mt(Pt))/Math.PI;if(i>e)for(var o=St(r,t),a=1/Math.ceil(i/e),s=a;s<1;)n.push(o(s)),s+=a}var u,l;n.push(r=t)})),n}))}(t,l=l||5),c=(a||o)&&function(){var e=Rt(h),i=function(t,e){var n=r(Tt(t[0],(function(t){return t[0]})),2),i=n[0],o=n[1],a=r(Tt(t[0],(function(t){return t[1]})),2),s=a[0],u=a[1];if(Math.min(o-i,u-s)<e)return[];var l,f=s+(u-s)%e/2,h=[],c={type:"Polygon",coordinates:t},y=i+(o-i)%e/2;for(;y<o;){for(l=f;l<u;){var d=[y,l];Ot(d,c)&&h.push(d),l+=e}y+=e}return h}(t,l),o=[].concat(n(e),n(i)),a=[];if(i.length)!function(){for(var r=u.from(o),i={type:"Polygon",coordinates:t},s=function(t,s){var u,l=[0,1,2].map((function(e){return r.triangles[t+e]})),f=l.map((function(t){return o[t]}));if(l.some((function(t){return t<e.length}))&&!Ot([0,1].map((function(t){return function(t,e){let r=0,n=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(++r,n+=e);else{let i=-1;for(let o of t)null!=(o=e(o,++i,t))&&(o=+o)>=o&&(++r,n+=o)}if(r)return n/r}(f,(function(e){return e[t]}))})),i))return"continue";(u=a).push.apply(u,n(l))},l=0,f=r.triangles.length;l<f;l+=3)s(l)}();else{var s=g.flatten(h),f=s.vertices,c=s.holes;a=g(f,void 0===c?[]:c,2)}return{points:o,indices:a}}(),y=[],d=[],v=0,p=function(t){var e=Math.round(y.length/3),r=d.length;y=y.concat(t.vertices),d=d.concat(e?t.indices.map((function(t){return t+e})):t.indices),f.addGroup(r,d.length-r,v++)};function x(t,e){var n=t.map((function(t){return t.map((function(t){var n=r(t,2),i=n[0];return function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=(90-t)*Math.PI/180,i=(90-e)*Math.PI/180;return[r*Math.sin(n)*Math.cos(i),r*Math.cos(n),r*Math.sin(n)*Math.sin(i)]}(n[1],i,e)}))}));return g.flatten(n)}function m(t){return{indices:c.indices,vertices:x([c.points],t).vertices}}s&&p(function(){for(var t=x(h,e),r=t.vertices,n=t.holes,o=x(h,i).vertices,a=Rt([o,r]),s=Math.round(o.length/3),u=new Set(n),l=0,f=[],c=0;c<s;c++){var y=c+1;if(y===s)y=l;else if(u.has(y)){var d=y;y=l,l=d}f.push(c,c+s,y+s),f.push(y+s,y,c)}return{indices:f,vertices:a}}()),o&&p(m(e)),a&&p(m(i)),this.setIndex(d),this[Zt]("position",new Ft.Float32BufferAttribute(y,3)),this.computeFaceNormals(),this.computeVertexNormals()}function Ot(t,e){return Q(t,e)}Gt.prototype=Object.create(Ft.Geometry.prototype),Gt.prototype.constructor=Gt,kt.prototype=Object.create(Ft.BufferGeometry.prototype),kt.prototype.constructor=kt,t.ConicPolygonBufferGeometry=kt,t.ConicPolygonGeometry=Gt,Object.defineProperty(t,"__esModule",{value:!0})}));
// Version 1.3.5 three-conic-polygon-geometry - https://github.com/vasturiano/three-conic-polygon-geometry
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],t):t((e=e||self).THREE=e.THREE||{},e.THREE)}(this,(function(e,t){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return r}(e,t)||i(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||i(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}const a=Math.pow(2,-52),s=new Uint32Array(512);class u{static from(e,t=p,r=x){const n=e.length,i=new Float64Array(2*n);for(let o=0;o<n;o++){const n=e[o];i[2*o]=t(n),i[2*o+1]=r(n)}return new u(i)}constructor(e){const t=e.length>>1;if(t>0&&"number"!=typeof e[0])throw new Error("Expected coords to contain numbers.");this.coords=e;const r=Math.max(2*t-5,0);this._triangles=new Uint32Array(3*r),this._halfedges=new Int32Array(3*r),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.update()}update(){const{coords:e,_hullPrev:t,_hullNext:r,_hullTri:n,_hullHash:i}=this,o=e.length>>1;let s=1/0,u=1/0,f=-1/0,c=-1/0;for(let t=0;t<o;t++){const r=e[2*t],n=e[2*t+1];r<s&&(s=r),n<u&&(u=n),r>f&&(f=r),n>c&&(c=n),this._ids[t]=t}const v=(s+f)/2,p=(u+c)/2;let x,g,m,w=1/0;for(let t=0;t<o;t++){const r=l(v,p,e[2*t],e[2*t+1]);r<w&&(x=t,w=r)}const b=e[2*x],_=e[2*x+1];w=1/0;for(let t=0;t<o;t++){if(t===x)continue;const r=l(b,_,e[2*t],e[2*t+1]);r<w&&r>0&&(g=t,w=r)}let E=e[2*g],M=e[2*g+1],A=1/0;for(let t=0;t<o;t++){if(t===x||t===g)continue;const r=y(b,_,E,M,e[2*t],e[2*t+1]);r<A&&(m=t,A=r)}let P=e[2*m],S=e[2*m+1];if(A===1/0){for(let t=0;t<o;t++)this._dists[t]=e[2*t]-e[0]||e[2*t+1]-e[1];d(this._ids,this._dists,0,o-1);const t=new Uint32Array(o);let r=0;for(let e=0,n=-1/0;e<o;e++){const i=this._ids[e];this._dists[i]>n&&(t[r++]=i,n=this._dists[i])}return this.hull=t.subarray(0,r),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(h(b,_,E,M,P,S)){const e=g,t=E,r=M;g=m,E=P,M=S,m=e,P=t,S=r}const T=function(e,t,r,n,i,o){const a=r-e,s=n-t,u=i-e,l=o-t,f=a*a+s*s,h=u*u+l*l,c=.5/(a*l-s*u);return{x:e+(l*f-s*h)*c,y:t+(a*h-u*f)*c}}(b,_,E,M,P,S);this._cx=T.x,this._cy=T.y;for(let t=0;t<o;t++)this._dists[t]=l(e[2*t],e[2*t+1],T.x,T.y);d(this._ids,this._dists,0,o-1),this._hullStart=x;let R=3;r[x]=t[m]=g,r[g]=t[x]=m,r[m]=t[g]=x,n[x]=0,n[g]=1,n[m]=2,i.fill(-1),i[this._hashKey(b,_)]=x,i[this._hashKey(E,M)]=g,i[this._hashKey(P,S)]=m,this.trianglesLen=0,this._addTriangle(x,g,m,-1,-1,-1);for(let o,s,u=0;u<this._ids.length;u++){const l=this._ids[u],f=e[2*l],c=e[2*l+1];if(u>0&&Math.abs(f-o)<=a&&Math.abs(c-s)<=a)continue;if(o=f,s=c,l===x||l===g||l===m)continue;let y=0;for(let e=0,t=this._hashKey(f,c);e<this._hashSize&&(y=i[(t+e)%this._hashSize],-1===y||y===r[y]);e++);y=t[y];let d,v=y;for(;d=r[v],!h(f,c,e[2*v],e[2*v+1],e[2*d],e[2*d+1]);)if(v=d,v===y){v=-1;break}if(-1===v)continue;let p=this._addTriangle(v,l,r[v],-1,-1,n[v]);n[l]=this._legalize(p+2),n[v]=p,R++;let w=r[v];for(;d=r[w],h(f,c,e[2*w],e[2*w+1],e[2*d],e[2*d+1]);)p=this._addTriangle(w,l,d,n[l],-1,n[w]),n[l]=this._legalize(p+2),r[w]=w,R--,w=d;if(v===y)for(;d=t[v],h(f,c,e[2*d],e[2*d+1],e[2*v],e[2*v+1]);)p=this._addTriangle(d,l,v,-1,n[v],n[d]),this._legalize(p+2),n[d]=p,r[v]=v,R--,v=d;this._hullStart=t[l]=v,r[v]=t[w]=l,r[l]=w,i[this._hashKey(f,c)]=l,i[this._hashKey(e[2*v],e[2*v+1])]=v}this.hull=new Uint32Array(R);for(let e=0,t=this._hullStart;e<R;e++)this.hull[e]=t,t=r[t];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(function(e,t){const r=e/(Math.abs(e)+Math.abs(t));return(t>0?3-r:1+r)/4}(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:t,_halfedges:r,coords:n}=this;let i=0,o=0;for(;;){const a=r[e],u=e-e%3;if(o=u+(e+2)%3,-1===a){if(0===i)break;e=s[--i];continue}const l=a-a%3,f=u+(e+1)%3,h=l+(a+2)%3,y=t[o],d=t[e],v=t[f],p=t[h];if(c(n[2*y],n[2*y+1],n[2*d],n[2*d+1],n[2*v],n[2*v+1],n[2*p],n[2*p+1])){t[e]=p,t[a]=y;const n=r[h];if(-1===n){let t=this._hullStart;do{if(this._hullTri[t]===h){this._hullTri[t]=e;break}t=this._hullPrev[t]}while(t!==this._hullStart)}this._link(e,n),this._link(a,r[o]),this._link(o,h);const u=l+(a+1)%3;i<s.length&&(s[i++]=u)}else{if(0===i)break;e=s[--i]}}return o}_link(e,t){this._halfedges[e]=t,-1!==t&&(this._halfedges[t]=e)}_addTriangle(e,t,r,n,i,o){const a=this.trianglesLen;return this._triangles[a]=e,this._triangles[a+1]=t,this._triangles[a+2]=r,this._link(a,n),this._link(a+1,i),this._link(a+2,o),this.trianglesLen+=3,a}}function l(e,t,r,n){const i=e-r,o=t-n;return i*i+o*o}function f(e,t,r,n,i,o){const a=(n-t)*(i-e),s=(r-e)*(o-t);return Math.abs(a-s)>=33306690738754716e-32*Math.abs(a+s)?a-s:0}function h(e,t,r,n,i,o){return(f(i,o,e,t,r,n)||f(e,t,r,n,i,o)||f(r,n,i,o,e,t))<0}function c(e,t,r,n,i,o,a,s){const u=e-a,l=t-s,f=r-a,h=n-s,c=i-a,y=o-s,d=f*f+h*h,v=c*c+y*y;return u*(h*v-d*y)-l*(f*v-d*c)+(u*u+l*l)*(f*y-h*c)<0}function y(e,t,r,n,i,o){const a=r-e,s=n-t,u=i-e,l=o-t,f=a*a+s*s,h=u*u+l*l,c=.5/(a*l-s*u),y=(l*f-s*h)*c,d=(a*h-u*f)*c;return y*y+d*d}function d(e,t,r,n){if(n-r<=20)for(let i=r+1;i<=n;i++){const n=e[i],o=t[n];let a=i-1;for(;a>=r&&t[e[a]]>o;)e[a+1]=e[a--];e[a+1]=n}else{let i=r+1,o=n;v(e,r+n>>1,i),t[e[r]]>t[e[n]]&&v(e,r,n),t[e[i]]>t[e[n]]&&v(e,i,n),t[e[r]]>t[e[i]]&&v(e,r,i);const a=e[i],s=t[a];for(;;){do{i++}while(t[e[i]]<s);do{o--}while(t[e[o]]>s);if(o<i)break;v(e,i,o)}e[r+1]=e[o],e[o]=a,n-i+1>=o-r?(d(e,t,i,n),d(e,t,r,o-1)):(d(e,t,r,o-1),d(e,t,i,n))}}function v(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function p(e){return e[0]}function x(e){return e[1]}var g=w,m=w;function w(e,t,r){r=r||2;var n,i,o,a,s,u,l,f=t&&t.length,h=f?t[0]*r:e.length,c=b(e,0,h,r,!0),y=[];if(!c||c.next===c.prev)return y;if(f&&(c=function(e,t,r,n){var i,o,a,s,u,l=[];for(i=0,o=t.length;i<o;i++)a=t[i]*n,s=i<o-1?t[i+1]*n:e.length,(u=b(e,a,s,n,!1))===u.next&&(u.steiner=!0),l.push(G(u));for(l.sort(T),i=0;i<l.length;i++)R(l[i],r),r=_(r,r.next);return r}(e,t,c,r)),e.length>80*r){n=o=e[0],i=a=e[1];for(var d=r;d<h;d+=r)(s=e[d])<n&&(n=s),(u=e[d+1])<i&&(i=u),s>o&&(o=s),u>a&&(a=u);l=0!==(l=Math.max(o-n,a-i))?1/l:0}return E(c,y,r,n,i,l),y}function b(e,t,r,n,i){var o,a;if(i===D(e,t,r,n)>0)for(o=t;o<r;o+=n)a=N(o,e[o],e[o+1],a);else for(o=r-n;o>=t;o-=n)a=N(o,e[o],e[o+1],a);return a&&z(a,a.next)&&(H(a),a=a.next),a}function _(e,t){if(!e)return e;t||(t=e);var r,n=e;do{if(r=!1,n.steiner||!z(n,n.next)&&0!==I(n.prev,n,n.next))n=n.next;else{if(H(n),(n=t=n.prev)===n.next)break;r=!0}}while(r||n!==t);return t}function E(e,t,r,n,i,o,a){if(e){!a&&o&&function(e,t,r,n){var i=e;do{null===i.z&&(i.z=Z(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,r,n,i,o,a,s,u,l=1;do{for(r=e,e=null,o=null,a=0;r;){for(a++,n=r,s=0,t=0;t<l&&(s++,n=n.nextZ);t++);for(u=l;s>0||u>0&&n;)0!==s&&(0===u||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,u--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;r=n}o.nextZ=null,l*=2}while(a>1)}(i)}(e,n,i,o);for(var s,u,l=e;e.prev!==e.next;)if(s=e.prev,u=e.next,o?A(e,n,i,o):M(e))t.push(s.i/r),t.push(e.i/r),t.push(u.i/r),H(e),e=u.next,l=u.next;else if((e=u)===l){a?1===a?E(e=P(_(e),t,r),t,r,n,i,o,2):2===a&&S(e,t,r,n,i,o):E(_(e),t,r,n,i,o,1);break}}}function M(e){var t=e.prev,r=e,n=e.next;if(I(t,r,n)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(k(t.x,t.y,r.x,r.y,n.x,n.y,i.x,i.y)&&I(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function A(e,t,r,n){var i=e.prev,o=e,a=e.next;if(I(i,o,a)>=0)return!1;for(var s=i.x<o.x?i.x<a.x?i.x:a.x:o.x<a.x?o.x:a.x,u=i.y<o.y?i.y<a.y?i.y:a.y:o.y<a.y?o.y:a.y,l=i.x>o.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,f=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,h=Z(s,u,t,r,n),c=Z(l,f,t,r,n),y=e.prevZ,d=e.nextZ;y&&y.z>=h&&d&&d.z<=c;){if(y!==e.prev&&y!==e.next&&k(i.x,i.y,o.x,o.y,a.x,a.y,y.x,y.y)&&I(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,d!==e.prev&&d!==e.next&&k(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&I(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;y&&y.z>=h;){if(y!==e.prev&&y!==e.next&&k(i.x,i.y,o.x,o.y,a.x,a.y,y.x,y.y)&&I(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;d&&d.z<=c;){if(d!==e.prev&&d!==e.next&&k(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&I(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function P(e,t,r){var n=e;do{var i=n.prev,o=n.next.next;!z(i,o)&&C(i,n,n.next,o)&&q(i,o)&&q(o,i)&&(t.push(i.i/r),t.push(n.i/r),t.push(o.i/r),H(n),H(n.next),n=e=o),n=n.next}while(n!==e);return _(n)}function S(e,t,r,n,i,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&O(a,s)){var u=B(a,s);return a=_(a,a.next),u=_(u,u.next),E(a,t,r,n,i,o),void E(u,t,r,n,i,o)}s=s.next}a=a.next}while(a!==e)}function T(e,t){return e.x-t.x}function R(e,t){if(t=function(e,t){var r,n=t,i=e.x,o=e.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>a){if(a=s,s===i){if(o===n.y)return n;if(o===n.next.y)return n.next}r=n.x<n.next.x?n:n.next}}n=n.next}while(n!==t);if(!r)return null;if(i===a)return r;var u,l=r,f=r.x,h=r.y,c=1/0;n=r;do{i>=n.x&&n.x>=f&&i!==n.x&&k(o<h?i:a,o,f,h,o<h?a:i,o,n.x,n.y)&&(u=Math.abs(o-n.y)/(i-n.x),q(n,e)&&(u<c||u===c&&(n.x>r.x||n.x===r.x&&F(r,n)))&&(r=n,c=u)),n=n.next}while(n!==l);return r}(e,t)){var r=B(t,e);_(t,t.next),_(r,r.next)}}function F(e,t){return I(e.prev,e,t.prev)<0&&I(t.next,e,e.next)<0}function Z(e,t,r,n,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function G(e){var t=e,r=e;do{(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next}while(t!==e);return r}function k(e,t,r,n,i,o,a,s){return(i-a)*(t-s)-(e-a)*(o-s)>=0&&(e-a)*(n-s)-(r-a)*(t-s)>=0&&(r-a)*(o-s)-(i-a)*(n-s)>=0}function O(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&C(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&(q(e,t)&&q(t,e)&&function(e,t){var r=e,n=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==e);return n}(e,t)&&(I(e.prev,e,t.prev)||I(e,t.prev,t))||z(e,t)&&I(e.prev,e,e.next)>0&&I(t.prev,t,t.next)>0)}function I(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function z(e,t){return e.x===t.x&&e.y===t.y}function C(e,t,r,n){var i=L(I(e,t,r)),o=L(I(e,t,n)),a=L(I(r,n,e)),s=L(I(r,n,t));return i!==o&&a!==s||(!(0!==i||!j(e,r,t))||(!(0!==o||!j(e,n,t))||(!(0!==a||!j(r,e,n))||!(0!==s||!j(r,t,n)))))}function j(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function L(e){return e>0?1:e<0?-1:0}function q(e,t){return I(e.prev,e,e.next)<0?I(e,t,e.next)>=0&&I(e,e.prev,t)>=0:I(e,t,e.prev)<0||I(e,e.next,t)<0}function B(e,t){var r=new U(e.i,e.x,e.y),n=new U(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function N(e,t,r,n){var i=new U(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function H(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function U(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function D(e,t,r,n){for(var i=0,o=t,a=r-n;o<r;o+=n)i+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return i}function K(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function J(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}w.deviation=function(e,t,r,n){var i=t&&t.length,o=i?t[0]*r:e.length,a=Math.abs(D(e,0,o,r));if(i)for(var s=0,u=t.length;s<u;s++){var l=t[s]*r,f=s<u-1?t[s+1]*r:e.length;a-=Math.abs(D(e,l,f,r))}var h=0;for(s=0;s<n.length;s+=3){var c=n[s]*r,y=n[s+1]*r,d=n[s+2]*r;h+=Math.abs((e[c]-e[d])*(e[y+1]-e[c+1])-(e[c]-e[y])*(e[d+1]-e[c+1]))}return 0===a&&0===h?0:Math.abs((h-a)/a)},w.flatten=function(e){for(var t=e[0][0].length,r={vertices:[],holes:[],dimensions:t},n=0,i=0;i<e.length;i++){for(var o=0;o<e[i].length;o++)for(var a=0;a<t;a++)r.vertices.push(e[i][o][a]);i>0&&(n+=e[i-1].length,r.holes.push(n))}return r},g.default=m;var V=J((function(e,t){function r(e,t,r){void 0===r&&(r={});var n={type:"Feature"};return(0===r.id||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=t||{},n.geometry=e,n}function n(e,t,n){return void 0===n&&(n={}),r({type:"Point",coordinates:e},t,n)}function i(e,t,n){void 0===n&&(n={});for(var i=0,o=e;i<o.length;i++){var a=o[i];if(a.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<a[a.length-1].length;s++)if(a[a.length-1][s]!==a[0][s])throw new Error("First and last Position are not equivalent.")}return r({type:"Polygon",coordinates:e},t,n)}function o(e,t,n){if(void 0===n&&(n={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");return r({type:"LineString",coordinates:e},t,n)}function a(e,t){void 0===t&&(t={});var r={type:"FeatureCollection"};return t.id&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.features=e,r}function s(e,t,n){return void 0===n&&(n={}),r({type:"MultiLineString",coordinates:e},t,n)}function u(e,t,n){return void 0===n&&(n={}),r({type:"MultiPoint",coordinates:e},t,n)}function l(e,t,n){return void 0===n&&(n={}),r({type:"MultiPolygon",coordinates:e},t,n)}function f(e,r){void 0===r&&(r="kilometers");var n=t.factors[r];if(!n)throw new Error(r+" units is invalid");return e*n}function h(e,r){void 0===r&&(r="kilometers");var n=t.factors[r];if(!n)throw new Error(r+" units is invalid");return e/n}function c(e){return 180*(e%(2*Math.PI))/Math.PI}function y(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)&&!/^\s*$/.test(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.earthRadius=6371008.8,t.factors={centimeters:100*t.earthRadius,centimetres:100*t.earthRadius,degrees:t.earthRadius/111325,feet:3.28084*t.earthRadius,inches:39.37*t.earthRadius,kilometers:t.earthRadius/1e3,kilometres:t.earthRadius/1e3,meters:t.earthRadius,metres:t.earthRadius,miles:t.earthRadius/1609.344,millimeters:1e3*t.earthRadius,millimetres:1e3*t.earthRadius,nauticalmiles:t.earthRadius/1852,radians:1,yards:t.earthRadius/1.0936},t.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/t.earthRadius,yards:1/1.0936},t.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046},t.feature=r,t.geometry=function(e,t,r){switch(e){case"Point":return n(t).geometry;case"LineString":return o(t).geometry;case"Polygon":return i(t).geometry;case"MultiPoint":return u(t).geometry;case"MultiLineString":return s(t).geometry;case"MultiPolygon":return l(t).geometry;default:throw new Error(e+" is invalid")}},t.point=n,t.points=function(e,t,r){return void 0===r&&(r={}),a(e.map((function(e){return n(e,t)})),r)},t.polygon=i,t.polygons=function(e,t,r){return void 0===r&&(r={}),a(e.map((function(e){return i(e,t)})),r)},t.lineString=o,t.lineStrings=function(e,t,r){return void 0===r&&(r={}),a(e.map((function(e){return o(e,t)})),r)},t.featureCollection=a,t.multiLineString=s,t.multiPoint=u,t.multiPolygon=l,t.geometryCollection=function(e,t,n){return void 0===n&&(n={}),r({type:"GeometryCollection",geometries:e},t,n)},t.round=function(e,t){if(void 0===t&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,t||0);return Math.round(e*r)/r},t.radiansToLength=f,t.lengthToRadians=h,t.lengthToDegrees=function(e,t){return c(h(e,t))},t.bearingToAzimuth=function(e){var t=e%360;return t<0&&(t+=360),t},t.radiansToDegrees=c,t.degreesToRadians=function(e){return e%360*Math.PI/180},t.convertLength=function(e,t,r){if(void 0===t&&(t="kilometers"),void 0===r&&(r="kilometers"),!(e>=0))throw new Error("length must be a positive number");return f(h(e,t),r)},t.convertArea=function(e,r,n){if(void 0===r&&(r="meters"),void 0===n&&(n="kilometers"),!(e>=0))throw new Error("area must be a positive number");var i=t.areaFactors[r];if(!i)throw new Error("invalid original units");var o=t.areaFactors[n];if(!o)throw new Error("invalid final units");return e/i*o},t.isNumber=y,t.isObject=function(e){return!!e&&e.constructor===Object},t.validateBBox=function(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(4!==e.length&&6!==e.length)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach((function(e){if(!y(e))throw new Error("bbox must only contain numbers")}))},t.validateId=function(e){if(!e)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof e))throw new Error("id must be a number or a string")},t.radians2degrees=function(){throw new Error("method has been renamed to `radiansToDegrees`")},t.degrees2radians=function(){throw new Error("method has been renamed to `degreesToRadians`")},t.distanceToDegrees=function(){throw new Error("method has been renamed to `lengthToDegrees`")},t.distanceToRadians=function(){throw new Error("method has been renamed to `lengthToRadians`")},t.radiansToDistance=function(){throw new Error("method has been renamed to `radiansToLength`")},t.bearingToAngle=function(){throw new Error("method has been renamed to `bearingToAzimuth`")},t.convertDistance=function(){throw new Error("method has been renamed to `convertLength`")}})),$=J((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getCoord=function(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return e.geometry.coordinates;if("Point"===e.type)return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")},t.getCoords=function(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")},t.containsNumber=function e(t){if(t.length>1&&V.isNumber(t[0])&&V.isNumber(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return e(t[0]);throw new Error("coordinates must only contain numbers")},t.geojsonType=function(e,t,r){if(!t||!r)throw new Error("type and name required");if(!e||e.type!==t)throw new Error("Invalid input to "+r+": must be a "+t+", given "+e.type)},t.featureOf=function(e,t,r){if(!e)throw new Error("No feature passed");if(!r)throw new Error(".featureOf() requires a name");if(!e||"Feature"!==e.type||!e.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!e.geometry||e.geometry.type!==t)throw new Error("Invalid input to "+r+": must be a "+t+", given "+e.geometry.type)},t.collectionOf=function(e,t,r){if(!e)throw new Error("No featureCollection passed");if(!r)throw new Error(".collectionOf() requires a name");if(!e||"FeatureCollection"!==e.type)throw new Error("Invalid input to "+r+", FeatureCollection required");for(var n=0,i=e.features;n<i.length;n++){var o=i[n];if(!o||"Feature"!==o.type||!o.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!o.geometry||o.geometry.type!==t)throw new Error("Invalid input to "+r+": must be a "+t+", given "+o.geometry.type)}},t.getGeom=function(e){return"Feature"===e.type?e.geometry:e},t.getType=function(e,t){return"FeatureCollection"===e.type?"FeatureCollection":"GeometryCollection"===e.type?"GeometryCollection":"Feature"===e.type&&null!==e.geometry?e.geometry.type:e.type}})),Q=K(J((function(e,t){function r(e,t,r){var n=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var i=0,o=t.length-1;i<t.length;o=i++){var a=t[i][0],s=t[i][1],u=t[o][0],l=t[o][1];if(e[1]*(a-u)+s*(u-e[0])+l*(e[0]-a)==0&&(a-e[0])*(u-e[0])<=0&&(s-e[1])*(l-e[1])<=0)return!r;s>e[1]!=l>e[1]&&e[0]<(u-a)*(e[1]-s)/(l-s)+a&&(n=!n)}return n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){if(void 0===n&&(n={}),!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");var i=$.getCoord(e),o=$.getGeom(t),a=o.type,s=t.bbox,u=o.coordinates;if(s&&!1===function(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}(i,s))return!1;"Polygon"===a&&(u=[u]);for(var l=!1,f=0;f<u.length&&!l;f++)if(r(i,u[f][0],n.ignoreBoundary)){for(var h=!1,c=1;c<u[f].length&&!h;)r(i,u[f][c],!n.ignoreBoundary)&&(h=!0),c++;h||(l=!0)}return l}})));function W(){this.reset()}W.prototype={constructor:W,reset:function(){this.s=this.t=0},add:function(e){Y(X,e,this.t),Y(this,X.s,this.s),this.s?this.t+=X.t:this.s=X.t},valueOf:function(){return this.s}};var X=new W;function Y(e,t,r){var n=e.s=t+r,i=n-t,o=n-i;e.t=t-o+(r-i)}var ee=Math.PI,te=ee/2,re=180/ee,ne=ee/180,ie=Math.abs,oe=Math.atan2,ae=Math.cos,se=Math.sin,ue=Math.sqrt;function le(e){return(e=se(e/2))*e}function fe(){}function he(e,t){e&&ye.hasOwnProperty(e.type)&&ye[e.type](e,t)}var ce={Feature:function(e,t){he(e.geometry,t)},FeatureCollection:function(e,t){for(var r=e.features,n=-1,i=r.length;++n<i;)he(r[n].geometry,t)}},ye={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)e=r[n],t.point(e[0],e[1],e[2])},LineString:function(e,t){de(e.coordinates,t,0)},MultiLineString:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)de(r[n],t,0)},Polygon:function(e,t){ve(e.coordinates,t)},MultiPolygon:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)ve(r[n],t)},GeometryCollection:function(e,t){for(var r=e.geometries,n=-1,i=r.length;++n<i;)he(r[n],t)}};function de(e,t,r){var n,i=-1,o=e.length-r;for(t.lineStart();++i<o;)n=e[i],t.point(n[0],n[1],n[2]);t.lineEnd()}function ve(e,t){var r=-1,n=e.length;for(t.polygonStart();++r<n;)de(e[r],t,1);t.polygonEnd()}var pe,xe,ge,me=new W,we={sphere:fe,point:fe,lineStart:function(){we.point=_e,we.lineEnd=be},lineEnd:fe,polygonStart:fe,polygonEnd:fe};function be(){we.point=we.lineEnd=fe}function _e(e,t){pe=e*=ne,xe=se(t*=ne),ge=ae(t),we.point=Ee}function Ee(e,t){e*=ne;var r=se(t*=ne),n=ae(t),i=ie(e-pe),o=ae(i),a=n*se(i),s=ge*r-xe*n*o,u=xe*r+ge*n*o;me.add(oe(ue(a*a+s*s),u)),pe=e,xe=r,ge=n}function Me(e){return me.reset(),function(e,t){e&&ce.hasOwnProperty(e.type)?ce[e.type](e,t):he(e,t)}(e,we),+me}var Ae=[null,null],Pe={type:"LineString",coordinates:Ae};function Se(e,t){var r,n=e[0]*ne,i=e[1]*ne,o=t[0]*ne,a=t[1]*ne,s=ae(i),u=se(i),l=ae(a),f=se(a),h=s*ae(n),c=s*se(n),y=l*ae(o),d=l*se(o),v=2*((r=ue(le(a-i)+s*l*le(o-n)))>1?te:r<-1?-te:Math.asin(r)),p=se(v),x=v?function(e){var t=se(e*=v)/p,r=se(v-e)/p,n=r*h+t*y,i=r*c+t*d,o=r*u+t*f;return[oe(i,n)*re,oe(o,ue(n*n+i*i))*re]}:function(){return[n*re,i*re]};return x.distance=v,x}function Te(e,t){let r,n;if(void 0===t)for(const t of e)null!=t&&(void 0===r?t>=t&&(r=n=t):(r>t&&(r=t),n<t&&(n=t)));else{let i=-1;for(let o of e)null!=(o=t(o,++i,e))&&(void 0===r?o>=o&&(r=n=o):(r>o&&(r=o),n<o&&(n=o)))}return[r,n]}function Re(e){return Array.from(function*(e){for(const t of e)yield*t}(e))}var Fe=window.THREE?window.THREE:{BufferGeometry:t.BufferGeometry,Float32BufferAttribute:t.Float32BufferAttribute,Geometry:t.Geometry},Ze=(new Fe.BufferGeometry).setAttribute?"setAttribute":"addAttribute";function Ge(e,t,r,n,i,o,a){Fe.Geometry.call(this),this.type="ConicPolygonGeometry",this.parameters={polygonGeoJson:e,startHeight:t,endHeight:r,closedBottom:n,closedTop:i,includeSides:o,curvatureResolution:a},this.fromBufferGeometry(new ke(e,t,r,n,i,o)),this.mergeVertices()}function ke(e,t,i,o,a,s,l){var f=this;Fe.BufferGeometry.call(this),this.type="ConicPolygonBufferGeometry",this.parameters={polygonGeoJson:e,startHeight:t,endHeight:i,closedBottom:o,closedTop:a,includeSides:s,curvatureResolution:l},t=t||0,i=i||1,o=void 0===o||o,a=void 0===a||a,s=void 0===s||s;var h=function(e,t){return e.map((function(e){var r,n=[];return e.forEach((function(e){if(r){var i=180*(u=e,l=r,Ae[0]=u,Ae[1]=l,Me(Pe))/Math.PI;if(i>t)for(var o=Se(r,e),a=1/Math.ceil(i/t),s=a;s<1;)n.push(o(s)),s+=a}var u,l;n.push(r=e)})),n}))}(e,l=l||5),c=(a||o)&&function(){var t=Re(h),i=function(e,t){var n=r(Te(e[0],(function(e){return e[0]})),2),i=n[0],o=n[1],a=r(Te(e[0],(function(e){return e[1]})),2),s=a[0],u=a[1];if(Math.min(o-i,u-s)<t)return[];var l,f=s+(u-s)%t/2,h=[],c={type:"Polygon",coordinates:e},y=i+(o-i)%t/2;for(;y<o;){for(l=f;l<u;){var d=[y,l];Oe(d,c)&&h.push(d),l+=t}y+=t}return h}(e,l),o=[].concat(n(t),n(i)),a=[];if(i.length)!function(){for(var r=u.from(o),i={type:"Polygon",coordinates:e},s=function(e,s){var u,l=[2,1,0].map((function(t){return r.triangles[e+t]})),f=l.map((function(e){return o[e]}));if(l.some((function(e){return e<t.length}))&&!Oe([0,1].map((function(e){return function(e,t){let r=0,n=0;if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(++r,n+=t);else{let i=-1;for(let o of e)null!=(o=t(o,++i,e))&&(o=+o)>=o&&(++r,n+=o)}if(r)return n/r}(f,(function(t){return t[e]}))})),i))return"continue";(u=a).push.apply(u,n(l))},l=0,f=r.triangles.length;l<f;l+=3)s(l)}();else{var s=g.flatten(h),f=s.vertices,c=s.holes;a=g(f,void 0===c?[]:c,2)}return{points:o,indices:a}}(),y=[],d=[],v=0,p=function(e){var t=Math.round(y.length/3),r=d.length;y=y.concat(e.vertices),d=d.concat(t?e.indices.map((function(e){return e+t})):e.indices),f.addGroup(r,d.length-r,v++)};function x(e,t){var n=e.map((function(e){return e.map((function(e){var n=r(e,2),i=n[0];return function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=(90-e)*Math.PI/180,i=(90-t)*Math.PI/180;return[r*Math.sin(n)*Math.cos(i),r*Math.cos(n),r*Math.sin(n)*Math.sin(i)]}(n[1],i,t)}))}));return g.flatten(n)}function m(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return{indices:t?c.indices:c.indices.slice().reverse(),vertices:x([c.points],e).vertices}}s&&p(function(){for(var e=x(h,t),r=e.vertices,n=e.holes,o=x(h,i).vertices,a=Re([o,r]),s=Math.round(o.length/3),u=new Set(n),l=0,f=[],c=0;c<s;c++){var y=c+1;if(y===s)y=l;else if(u.has(y)){var d=y;y=l,l=d}f.push(c,c+s,y+s),f.push(y+s,y,c)}return{indices:f,vertices:a}}()),o&&p(m(t,!1)),a&&p(m(i,!0)),this.setIndex(d),this[Ze]("position",new Fe.Float32BufferAttribute(y,3)),this.computeFaceNormals(),this.computeVertexNormals()}function Oe(e,t){return Q(e,t)}Ge.prototype=Object.create(Fe.Geometry.prototype),Ge.prototype.constructor=Ge,ke.prototype=Object.create(Fe.BufferGeometry.prototype),ke.prototype.constructor=ke,e.ConicPolygonBufferGeometry=ke,e.ConicPolygonGeometry=Ge,Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -149,4 +149,4 @@ import { BufferGeometry, Float32BufferAttribute, Geometry } from 'three';

includeSides && addGroup(generateTorso());
closedBottom && addGroup(generateCap(startHeight));
closedTop && addGroup(generateCap(endHeight)); // build geometry
closedBottom && addGroup(generateCap(startHeight, false));
closedTop && addGroup(generateCap(endHeight, true)); // build geometry

@@ -211,4 +211,6 @@ this.setIndex(indices);

function generateCap(radius) {
var isTop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
return {
indices: geoTriangles.indices,
// need to reverse-wind the bottom triangles to make them face outwards
indices: isTop ? geoTriangles.indices : geoTriangles.indices.slice().reverse(),
vertices: generateVertices([geoTriangles.points], radius).vertices

@@ -243,5 +245,6 @@ };

var inds = [0, 1, 2].map(function (idx) {
var inds = [2, 1, 0].map(function (idx) {
return delaunay.triangles[i + idx];
});
}); // reverse wound to have same orientation as earcut
var triangle = inds.map(function (indice) {

@@ -248,0 +251,0 @@ return points[indice];

{
"name": "three-conic-polygon-geometry",
"version": "1.3.4",
"version": "1.3.5",
"description": "ThreeJS geometry for drawing polygons on a sphere",

@@ -5,0 +5,0 @@ "unpkg": "dist/three-conic-polygon-geometry.min.js",

@@ -89,4 +89,4 @@ import {

includeSides && addGroup(generateTorso());
closedBottom && addGroup(generateCap(startHeight));
closedTop && addGroup(generateCap(endHeight));
closedBottom && addGroup(generateCap(startHeight, false));
closedTop && addGroup(generateCap(endHeight, true));

@@ -138,5 +138,6 @@ // build geometry

function generateCap(radius) {
function generateCap(radius, isTop= true) {
return {
indices: geoTriangles.indices,
// need to reverse-wind the bottom triangles to make them face outwards
indices: isTop ? geoTriangles.indices : geoTriangles.indices.slice().reverse(),
vertices: generateVertices([geoTriangles.points], radius).vertices

@@ -162,3 +163,3 @@ }

for (let i = 0, len = delaunay.triangles.length; i < len; i += 3) {
const inds = [0, 1, 2].map(idx => delaunay.triangles[i + idx]);
const inds = [2, 1, 0].map(idx => delaunay.triangles[i + idx]); // reverse wound to have same orientation as earcut
const triangle = inds.map(indice => points[indice]);

@@ -165,0 +166,0 @@

Sorry, the diff of this file is too big to display

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc