New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

three-geojson-geometry

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

three-geojson-geometry - npm Package Compare versions

Comparing version

to
1.0.1

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

// Version 1.0.0 three-geojson-geometry - https://github.com/vasturiano/three-geojson-geometry
// Version 1.0.1 three-geojson-geometry - https://github.com/vasturiano/three-geojson-geometry
(function (global, factory) {

@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three')) :

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

// Version 1.0.0 three-geojson-geometry - https://github.com/vasturiano/three-geojson-geometry
// Version 1.0.1 three-geojson-geometry - https://github.com/vasturiano/three-geojson-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 n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,o=void 0;try{for(var u,x=e[Symbol.iterator]();!(r=(u=x.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==x.return||x.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var r=o,i=o;function o(e,t,n){n=n||2;var r,i,o,v,a,c,l,y=t&&t.length,d=y?t[0]*n:e.length,g=u(e,0,d,n,!0),Z=[];if(!g||g.next===g.prev)return Z;if(y&&(g=function(e,t,n,r){var i,o,f,v,a,c=[];for(i=0,o=t.length;i<o;i++)f=t[i]*r,v=i<o-1?t[i+1]*r:e.length,(a=u(e,f,v,r,!1))===a.next&&(a.steiner=!0),c.push(p(a));for(c.sort(h),i=0;i<c.length;i++)s(c[i],n),n=x(n,n.next);return n}(e,t,g,n)),e.length>80*n){r=o=e[0],i=v=e[1];for(var m=n;m<d;m+=n)(a=e[m])<r&&(r=a),(c=e[m+1])<i&&(i=c),a>o&&(o=a),c>v&&(v=c);l=0!==(l=Math.max(o-r,v-i))?1/l:0}return f(g,Z,n,r,i,l),Z}function u(e,t,n,r,i){var o,u;if(i===A(e,t,n,r)>0)for(o=t;o<n;o+=r)u=E(o,e[o],e[o+1],u);else for(o=n-r;o>=t;o-=r)u=E(o,e[o],e[o+1],u);return u&&m(u,u.next)&&(G(u),u=u.next),u}function x(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!m(r,r.next)&&0!==Z(r.prev,r,r.next))r=r.next;else{if(G(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function f(e,t,n,r,i,o,u){if(e){!u&&o&&function(e,t,n,r){var i=e;do{null===i.z&&(i.z=y(i.x,i.y,t,n,r)),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,n,r,i,o,u,x,f,v=1;do{for(n=e,e=null,o=null,u=0;n;){for(u++,r=n,x=0,t=0;t<v&&(x++,r=r.nextZ);t++);for(f=v;x>0||f>0&&r;)0!==x&&(0===f||!r||n.z<=r.z)?(i=n,n=n.nextZ,x--):(i=r,r=r.nextZ,f--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;n=r}o.nextZ=null,v*=2}while(u>1)}(i)}(e,r,i,o);for(var h,s,p=e;e.prev!==e.next;)if(h=e.prev,s=e.next,o?a(e,r,i,o):v(e))t.push(h.i/n),t.push(e.i/n),t.push(s.i/n),G(e),e=s.next,p=s.next;else if((e=s)===p){u?1===u?f(e=c(e,t,n),t,n,r,i,o,2):2===u&&l(e,t,n,r,i,o):f(x(e),t,n,r,i,o,1);break}}}function v(e){var t=e.prev,n=e,r=e.next;if(Z(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(d(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&Z(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function a(e,t,n,r){var i=e.prev,o=e,u=e.next;if(Z(i,o,u)>=0)return!1;for(var x=i.x<o.x?i.x<u.x?i.x:u.x:o.x<u.x?o.x:u.x,f=i.y<o.y?i.y<u.y?i.y:u.y:o.y<u.y?o.y:u.y,v=i.x>o.x?i.x>u.x?i.x:u.x:o.x>u.x?o.x:u.x,a=i.y>o.y?i.y>u.y?i.y:u.y:o.y>u.y?o.y:u.y,c=y(x,f,t,n,r),l=y(v,a,t,n,r),h=e.prevZ,s=e.nextZ;h&&h.z>=c&&s&&s.z<=l;){if(h!==e.prev&&h!==e.next&&d(i.x,i.y,o.x,o.y,u.x,u.y,h.x,h.y)&&Z(h.prev,h,h.next)>=0)return!1;if(h=h.prevZ,s!==e.prev&&s!==e.next&&d(i.x,i.y,o.x,o.y,u.x,u.y,s.x,s.y)&&Z(s.prev,s,s.next)>=0)return!1;s=s.nextZ}for(;h&&h.z>=c;){if(h!==e.prev&&h!==e.next&&d(i.x,i.y,o.x,o.y,u.x,u.y,h.x,h.y)&&Z(h.prev,h,h.next)>=0)return!1;h=h.prevZ}for(;s&&s.z<=l;){if(s!==e.prev&&s!==e.next&&d(i.x,i.y,o.x,o.y,u.x,u.y,s.x,s.y)&&Z(s.prev,s,s.next)>=0)return!1;s=s.nextZ}return!0}function c(e,t,n){var r=e;do{var i=r.prev,o=r.next.next;!m(i,o)&&w(i,r,r.next,o)&&M(i,o)&&M(o,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(o.i/n),G(r),G(r.next),r=e=o),r=r.next}while(r!==e);return r}function l(e,t,n,r,i,o){var u=e;do{for(var v=u.next.next;v!==u.prev;){if(u.i!==v.i&&g(u,v)){var a=b(u,v);return u=x(u,u.next),a=x(a,a.next),f(u,t,n,r,i,o),void f(a,t,n,r,i,o)}v=v.next}u=u.next}while(u!==e)}function h(e,t){return e.x-t.x}function s(e,t){if(t=function(e,t){var n,r=t,i=e.x,o=e.y,u=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var x=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(x<=i&&x>u){if(u=x,x===i){if(o===r.y)return r;if(o===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!n)return null;if(i===u)return n.prev;var f,v=n,a=n.x,c=n.y,l=1/0;r=n.next;for(;r!==v;)i>=r.x&&r.x>=a&&i!==r.x&&d(o<c?i:u,o,a,c,o<c?u:i,o,r.x,r.y)&&((f=Math.abs(o-r.y)/(i-r.x))<l||f===l&&r.x>n.x)&&M(r,e)&&(n=r,l=f),r=r.next;return n}(e,t)){var n=b(t,e);x(n,n.next)}}function y(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function p(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function d(e,t,n,r,i,o,u,x){return(i-u)*(t-x)-(e-u)*(o-x)>=0&&(e-u)*(r-x)-(n-u)*(t-x)>=0&&(n-u)*(o-x)-(i-u)*(r-x)>=0}function g(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&w(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&M(e,t)&&M(t,e)&&function(e,t){var n=e,r=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)}function Z(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function m(e,t){return e.x===t.x&&e.y===t.y}function w(e,t,n,r){return!!(m(e,t)&&m(n,r)||m(e,r)&&m(n,t))||Z(e,t,n)>0!=Z(e,t,r)>0&&Z(n,r,e)>0!=Z(n,r,t)>0}function M(e,t){return Z(e.prev,e,e.next)<0?Z(e,t,e.next)>=0&&Z(e,e.prev,t)>=0:Z(e,t,e.prev)<0||Z(e,e.next,t)<0}function b(e,t){var n=new z(e.i,e.x,e.y),r=new z(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function E(e,t,n,r){var i=new z(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function G(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 z(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function A(e,t,n,r){for(var i=0,o=t,u=n-r;o<n;o+=r)i+=(e[u]-e[o])*(e[o+1]+e[u+1]),u=o;return i}o.deviation=function(e,t,n,r){var i=t&&t.length,o=i?t[0]*n:e.length,u=Math.abs(A(e,0,o,n));if(i)for(var x=0,f=t.length;x<f;x++){var v=t[x]*n,a=x<f-1?t[x+1]*n:e.length;u-=Math.abs(A(e,v,a,n))}var c=0;for(x=0;x<r.length;x+=3){var l=r[x]*n,h=r[x+1]*n,s=r[x+2]*n;c+=Math.abs((e[l]-e[s])*(e[h+1]-e[l+1])-(e[l]-e[h])*(e[s+1]-e[l+1]))}return 0===u&&0===c?0:Math.abs((c-u)/u)},o.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},r=0,i=0;i<e.length;i++){for(var o=0;o<e[i].length;o++)for(var u=0;u<t;u++)n.vertices.push(e[i][o][u]);i>0&&(r+=e[i-1].length,n.holes.push(r))}return n},r.default=i;var B=function(e,t,n){for(var r=[],i=1;i<=n;i++)r.push(e+(t-e)*i/(n+1));return r},P=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=[],r=null;return e.forEach((function(e){if(r){var i=Math.sqrt(Math.pow(e[0]-r[0],2)+Math.pow(e[1]-r[1],2));if(i>t)for(var o=Math.floor(i/t),u=B(r[0],e[0],o),x=B(r[1],e[1],o),f=0,v=u.length;f<v;f++)n.push([u[f],x[f]])}n.push(r=e)})),n},S=window.THREE?window.THREE:{BufferGeometry:t.BufferGeometry,Float32BufferAttribute:t.Float32BufferAttribute,Geometry:t.Geometry};function j(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;S.BufferGeometry.call(this),this.type="GeoJsonGeometry",this.parameters={geoJson:e,radius:i,resolution:o};var u=({Point:a,MultiPoint:function(e,t){var r={vertices:[],indices:[]};return e.map((function(e){return a(e,t)})).forEach((function(e){var t=n(e,1)[0];T(r,t)})),[r]},LineString:c,MultiLineString:function(e,t){var r={vertices:[],indices:[]};return e.map((function(e){return c(e,t)})).forEach((function(e){var t=n(e,1)[0];T(r,t)})),[r]},Polygon:l,MultiPolygon:function(e,t){var r={vertices:[],indices:[]},i={vertices:[],indices:[]};e.map((function(e){return l(e,t)})).forEach((function(e){var t=n(e,2),o=t[0],u=t[1];T(r,o),u&&T(i,u)}));var o=[r];return i.vertices.length&&o.push(i),o}}[e.type]||function(){return[]})(e.coordinates,i),x=[],f=[],v=0;function a(e,t){return[{vertices:R(e[1],e[0],t),indices:[]}]}function c(e,t){for(var i=P(e,o).map((function(e){var r=n(e,2),i=r[0];return R(r[1],i,t)})),u=r.flatten([i]).vertices,x=Math.round(u.length/3),f=[],v=1;v<x;v++)f.push(v-1,v);return[{vertices:u,indices:f}]}function l(e,t){for(var i=e.map((function(e){return P(e,o).map((function(e){var r=n(e,2),i=r[0];return R(r[1],i,t)}))})),u=r.flatten(i),x=u.vertices,f=u.holes,v=f[0]||1/0,a=x.slice(0,v),c=x.slice(v),l=new Set(f),h=Math.round(x.length/3),s=[],y=[],p=1;p<h;p++)l.has(p)||(p<v?s.push(p-1,p):y.push(p-1-v,p-v));var d=[{indices:s,vertices:a}];return f.length&&d.push({indices:y,vertices:c}),d}u.forEach((function(e){var n=x.length;T({indices:x,vertices:f},e),t.addGroup(n,x.length-n,v++)})),x.length&&this.setIndex(x),f.length&&this.addAttribute("position",new S.Float32BufferAttribute(f,3))}function T(e,t){var n=Math.round(e.vertices.length/3);H(e.vertices,t.vertices),H(e.indices,t.indices.map((function(e){return e+n})))}function H(e,t){var n=!0,r=!1,i=void 0;try{for(var o,u=t[Symbol.iterator]();!(n=(o=u.next()).done);n=!0){var x=o.value;e.push(x)}}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}}function R(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=(90-e)*Math.PI/180,i=(90-t)*Math.PI/180;return[n*Math.sin(r)*Math.cos(i),n*Math.cos(r),n*Math.sin(r)*Math.sin(i)]}j.prototype=Object.create(S.BufferGeometry.prototype),j.prototype.constructor=j,e.GeoJsonGeometry=j,Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "three-geojson-geometry",
"version": "1.0.0",
"version": "1.0.1",
"description": "ThreeJS geometry for stroking GeoJSON objects on a sphere",

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

Sorry, the diff of this file is not supported yet