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

three-geojson-geometry

Package Overview
Dependencies
Maintainers
0
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

three-geojson-geometry - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

46

dist/three-geojson-geometry.js

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

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

@@ -16,2 +16,5 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('three')) :

}
function _arrayWithoutHoles(r) {
if (Array.isArray(r)) return _arrayLikeToArray(r);
}
function _assertThisInitialized(e) {

@@ -105,2 +108,5 @@ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");

}
function _iterableToArray(r) {
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
}
function _iterableToArrayLimit(r, l) {

@@ -136,2 +142,5 @@ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];

}
function _nonIterableSpread() {
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 _possibleConstructorReturn(t, e) {

@@ -150,2 +159,5 @@ if (e && ("object" == typeof e || "function" == typeof e)) return e;

}
function _toConsumableArray(r) {
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
}
function _unsupportedIterableToArray(r, a) {

@@ -307,3 +319,3 @@ if (r) {

function geoStream(object, stream) {
if (object && streamObjectType.hasOwnProperty(object.type)) {
if (streamObjectType.hasOwnProperty(object.type)) {
streamObjectType[object.type](object, stream);

@@ -408,2 +420,8 @@ } else {

function interpolateNumber(a, b) {
return a = +a, b = +b, function(t) {
return a * (1 - t) + b * t;
};
}
var interpolateLine = function interpolateLine() {

@@ -418,3 +436,7 @@ var lineCoords = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];

if (dist > maxDegDistance) {
var interpol = geoInterpolate(prevPnt, pnt);
var geoInterpol = geoInterpolate(prevPnt, pnt);
var altInterpol = prevPnt.length > 2 || pnt.length > 2 ? interpolateNumber(prevPnt[2] || 0, pnt[2] || 0) : null;
var interpol = altInterpol ? function (t) {
return [].concat(_toConsumableArray(geoInterpol(t)), [altInterpol(t)]);
} : geoInterpol;
var tStep = 1 / Math.ceil(dist / maxDegDistance);

@@ -487,3 +509,3 @@ var t = tStep;

function genPoint(coords, r) {
var vertices = polar2Cartesian(coords[1], coords[0], r);
var vertices = polar2Cartesian(coords[1], coords[0], r + (coords[2] || 0));
var indices = [];

@@ -511,6 +533,8 @@ return [{

var coords3d = interpolateLine(coords, resolution).map(function (_ref3) {
var _ref4 = _slicedToArray(_ref3, 2),
var _ref4 = _slicedToArray(_ref3, 3),
lng = _ref4[0],
lat = _ref4[1];
return polar2Cartesian(lat, lng, r);
lat = _ref4[1],
_ref4$ = _ref4[2],
alt = _ref4$ === void 0 ? 0 : _ref4$;
return polar2Cartesian(lat, lng, r + alt);
});

@@ -546,6 +570,8 @@ var _earcutFlatten = flatten([coords3d]),

return interpolateLine(coordsSegment, resolution).map(function (_ref7) {
var _ref8 = _slicedToArray(_ref7, 2),
var _ref8 = _slicedToArray(_ref7, 3),
lng = _ref8[0],
lat = _ref8[1];
return polar2Cartesian(lat, lng, r);
lat = _ref8[1],
_ref8$ = _ref8[2],
alt = _ref8$ === void 0 ? 0 : _ref8$;
return polar2Cartesian(lat, lng, r + alt);
});

@@ -552,0 +578,0 @@ });

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

// Version 2.0.0 three-geojson-geometry - https://github.com/vasturiano/three-geojson-geometry
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("three")):"function"==typeof define&&define.amd?define(["three"],n):(t="undefined"!=typeof globalThis?globalThis:t||self).GeoJsonGeometry=n(t.THREE)}(this,(function(t){"use strict";function n(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e<n;e++)r[e]=t[e];return r}function e(t,n,e){return n=r(n),function(t,n){if(n&&("object"==typeof n||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,o()?Reflect.construct(n,[],r(t).constructor):n.apply(t,e))}function r(t){return r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},r(t)}function o(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(o=function(){return!!t})()}function i(t,n){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},i(t,n)}function u(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var r,o,i,u,a=[],c=!0,f=!1;try{if(i=(e=e.call(t)).next,0===n){if(Object(e)!==e)return;c=!1}else for(;!(c=(r=i.call(e)).done)&&(a.push(r.value),a.length!==n);c=!0);}catch(t){f=!0,o=t}finally{try{if(!c&&null!=e.return&&(u=e.return(),Object(u)!==u))return}finally{if(f)throw o}}return a}}(t,n)||a(t,n)||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 a(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.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)?n(t,e):void 0}}function c(t){const n=[],e=[],r=t[0][0].length;let o=0,i=0;for(const u of t){for(const t of u)for(let e=0;e<r;e++)n.push(t[e]);i&&(o+=i,e.push(o)),i=u.length}return{vertices:n,holes:e,dimensions:r}}class f{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let e=0;for(let r=0;r<this._n&&r<32;r++){const o=n[r],i=t+o,u=Math.abs(t)<Math.abs(o)?t-(i-o):o-(i-t);u&&(n[e++]=u),t=i}return n[e]=t,this._n=e+1,this}valueOf(){const t=this._partials;let n,e,r,o=this._n,i=0;if(o>0){for(i=t[--o];o>0&&(n=i,e=t[--o],i=n+e,r=e-(i-n),!r););o>0&&(r<0&&t[o-1]<0||r>0&&t[o-1]>0)&&(e=2*r,n=i+e,e==n-i&&(i=n))}return i}}var l=Math.PI,s=l/2,h=180/l,p=l/180,d=Math.abs,v=Math.atan2,y=Math.cos,g=Math.sin,b=Math.sqrt;function m(t){return(t=g(t/2))*t}function w(){}function M(t,n){t&&A.hasOwnProperty(t.type)&&A[t.type](t,n)}var E,P,O,S,j={Feature:function(t,n){M(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,o=e.length;++r<o;)M(e[r].geometry,n)}},A={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,o=e.length;++r<o;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){_(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,o=e.length;++r<o;)_(e[r],n,0)},Polygon:function(t,n){G(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,o=e.length;++r<o;)G(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,o=e.length;++r<o;)M(e[r],n)}};function _(t,n,e){var r,o=-1,i=t.length-e;for(n.lineStart();++o<i;)r=t[o],n.point(r[0],r[1],r[2]);n.lineEnd()}function G(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)_(t[e],n,1);n.polygonEnd()}var I={sphere:w,point:w,lineStart:function(){I.point=B,I.lineEnd=T},lineEnd:w,polygonStart:w,polygonEnd:w};function T(){I.point=I.lineEnd=w}function B(t,n){P=t*=p,O=g(n*=p),S=y(n),I.point=x}function x(t,n){t*=p;var e=g(n*=p),r=y(n),o=d(t-P),i=y(o),u=r*g(o),a=S*e-O*r*i,c=O*e+S*r*i;E.add(v(b(u*u+a*a),c)),P=t,O=e,S=r}function F(t){return E=new f,function(t,n){t&&j.hasOwnProperty(t.type)?j[t.type](t,n):M(t,n)}(t,I),+E}var R=[null,null],L={type:"LineString",coordinates:R};function C(t,n){var e,r=t[0]*p,o=t[1]*p,i=n[0]*p,u=n[1]*p,a=y(o),c=g(o),f=y(u),l=g(u),d=a*y(r),w=a*g(r),M=f*y(i),E=f*g(i),P=2*((e=b(m(u-o)+a*f*m(i-r)))>1?s:e<-1?-s:Math.asin(e)),O=g(P),S=P?function(t){var n=g(t*=P)/O,e=g(P-t)/O,r=e*d+n*M,o=e*w+n*E,i=e*c+n*l;return[v(o,r)*h,v(i,b(r*r+o*o))*h]}:function(){return[r*h,o*h]};return S.distance=P,S}var H=function(){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=[],e=null;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((function(r){if(e){var o=180*(c=r,f=e,R[0]=c,R[1]=f,F(L))/Math.PI;if(o>t)for(var i=C(e,r),u=1/Math.ceil(o/t),a=u;a<1;)n.push(i(a)),a+=u}var c,f;n.push(e=r)})),n},J="undefined"!=typeof window&&window.THREE?window.THREE:{BufferGeometry:t.BufferGeometry,Float32BufferAttribute:t.Float32BufferAttribute},q=(new J.BufferGeometry).setAttribute?"setAttribute":"addAttribute",D=function(t){function n(t){var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n),(r=e(this,n)).type="GeoJsonGeometry",r.parameters={geoJson:t,radius:o,resolution:i};var a=({Point:h,MultiPoint:function(t,n){var e={vertices:[],indices:[]};return t.map((function(t){return h(t,n)})).forEach((function(t){var n=u(t,1)[0];U(e,n)})),[e]},LineString:p,MultiLineString:function(t,n){var e={vertices:[],indices:[]};return t.map((function(t){return p(t,n)})).forEach((function(t){var n=u(t,1)[0];U(e,n)})),[e]},Polygon:d,MultiPolygon:function(t,n){var e={vertices:[],indices:[]},r={vertices:[],indices:[]};t.map((function(t){return d(t,n)})).forEach((function(t){var n=u(t,2),o=n[0],i=n[1];U(e,o),i&&U(r,i)}));var o=[e];return r.vertices.length&&o.push(r),o}}[t.type]||function(){return[]})(t.coordinates,o),f=[],l=[],s=0;function h(t,n){return[{vertices:k(t[1],t[0],n),indices:[]}]}function p(t,n){for(var e=c([H(t,i).map((function(t){var e=u(t,2),r=e[0];return k(e[1],r,n)}))]).vertices,r=Math.round(e.length/3),o=[],a=1;a<r;a++)o.push(a-1,a);return[{vertices:e,indices:o}]}function d(t,n){for(var e=c(t.map((function(t){return H(t,i).map((function(t){var e=u(t,2),r=e[0];return k(e[1],r,n)}))}))),r=e.vertices,o=e.holes,a=o[0]||1/0,f=r.slice(0,3*a),l=r.slice(3*a),s=new Set(o),h=Math.round(r.length/3),p=[],d=[],v=1;v<h;v++)s.has(v)||(v<a?p.push(v-1,v):d.push(v-1-a,v-a));var y=[{indices:p,vertices:f}];return o.length&&y.push({indices:d,vertices:l}),y}return a.forEach((function(t){var n=f.length;U({indices:f,vertices:l},t),r.addGroup(n,f.length-n,s++)})),f.length&&r.setIndex(f),l.length&&r[q]("position",new J.Float32BufferAttribute(l,3)),r}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&i(t,n)}(n,t),r=n,Object.defineProperty(r,"prototype",{writable:!1}),r;var r}(J.BufferGeometry);function U(t,n){var e=Math.round(t.vertices.length/3);$(t.vertices,n.vertices),$(t.indices,n.indices.map((function(t){return t+e})))}function $(t,n){var e,r=function(t,n){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=a(t))||n){e&&(t=e);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,u=!0,c=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return u=t.done,t},e:function(t){c=!0,i=t},f:function(){try{u||null==e.return||e.return()}finally{if(c)throw i}}}}(n);try{for(r.s();!(e=r.n()).done;){var o=e.value;t.push(o)}}catch(t){r.e(t)}finally{r.f()}}function k(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=(90-t)*Math.PI/180,o=(90-n)*Math.PI/180;return[e*Math.sin(r)*Math.cos(o),e*Math.cos(r),e*Math.sin(r)*Math.sin(o)]}return D}));
// Version 2.1.0 three-geojson-geometry - https://github.com/vasturiano/three-geojson-geometry
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("three")):"function"==typeof define&&define.amd?define(["three"],n):(t="undefined"!=typeof globalThis?globalThis:t||self).GeoJsonGeometry=n(t.THREE)}(this,(function(t){"use strict";function n(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e<n;e++)r[e]=t[e];return r}function e(t,n,e){return n=r(n),function(t,n){if(n&&("object"==typeof n||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,o()?Reflect.construct(n,[],r(t).constructor):n.apply(t,e))}function r(t){return r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},r(t)}function o(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(o=function(){return!!t})()}function i(t,n){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},i(t,n)}function u(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var r,o,i,u,a=[],c=!0,f=!1;try{if(i=(e=e.call(t)).next,0===n){if(Object(e)!==e)return;c=!1}else for(;!(c=(r=i.call(e)).done)&&(a.push(r.value),a.length!==n);c=!0);}catch(t){f=!0,o=t}finally{try{if(!c&&null!=e.return&&(u=e.return(),Object(u)!==u))return}finally{if(f)throw o}}return a}}(t,n)||c(t,n)||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 a(t){return function(t){if(Array.isArray(t))return n(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||c(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 c(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.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)?n(t,e):void 0}}function f(t){const n=[],e=[],r=t[0][0].length;let o=0,i=0;for(const u of t){for(const t of u)for(let e=0;e<r;e++)n.push(t[e]);i&&(o+=i,e.push(o)),i=u.length}return{vertices:n,holes:e,dimensions:r}}class l{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let e=0;for(let r=0;r<this._n&&r<32;r++){const o=n[r],i=t+o,u=Math.abs(t)<Math.abs(o)?t-(i-o):o-(i-t);u&&(n[e++]=u),t=i}return n[e]=t,this._n=e+1,this}valueOf(){const t=this._partials;let n,e,r,o=this._n,i=0;if(o>0){for(i=t[--o];o>0&&(n=i,e=t[--o],i=n+e,r=e-(i-n),!r););o>0&&(r<0&&t[o-1]<0||r>0&&t[o-1]>0)&&(e=2*r,n=i+e,e==n-i&&(i=n))}return i}}var s=Math.PI,h=s/2,d=180/s,p=s/180,y=Math.abs,v=Math.atan2,b=Math.cos,g=Math.sin,m=Math.sqrt;function w(t){return(t=g(t/2))*t}function M(){}function E(t,n){t&&_.hasOwnProperty(t.type)&&_[t.type](t,n)}var S,P,O,A,j={Feature:function(t,n){E(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,o=e.length;++r<o;)E(e[r].geometry,n)}},_={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,o=e.length;++r<o;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){I(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,o=e.length;++r<o;)I(e[r],n,0)},Polygon:function(t,n){T(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,o=e.length;++r<o;)T(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,o=e.length;++r<o;)E(e[r],n)}};function I(t,n,e){var r,o=-1,i=t.length-e;for(n.lineStart();++o<i;)r=t[o],n.point(r[0],r[1],r[2]);n.lineEnd()}function T(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)I(t[e],n,1);n.polygonEnd()}var G={sphere:M,point:M,lineStart:function(){G.point=x,G.lineEnd=B},lineEnd:M,polygonStart:M,polygonEnd:M};function B(){G.point=G.lineEnd=M}function x(t,n){P=t*=p,O=g(n*=p),A=b(n),G.point=F}function F(t,n){t*=p;var e=g(n*=p),r=b(n),o=y(t-P),i=b(o),u=r*g(o),a=A*e-O*r*i,c=O*e+A*r*i;S.add(v(m(u*u+a*a),c)),P=t,O=e,A=r}function R(t){return S=new l,function(t,n){j.hasOwnProperty(t.type)?j[t.type](t,n):E(t,n)}(t,G),+S}var L=[null,null],C={type:"LineString",coordinates:L};function H(t,n){var e,r=t[0]*p,o=t[1]*p,i=n[0]*p,u=n[1]*p,a=b(o),c=g(o),f=b(u),l=g(u),s=a*b(r),y=a*g(r),M=f*b(i),E=f*g(i),S=2*((e=m(w(u-o)+a*f*w(i-r)))>1?h:e<-1?-h:Math.asin(e)),P=g(S),O=S?function(t){var n=g(t*=S)/P,e=g(S-t)/P,r=e*s+n*M,o=e*y+n*E,i=e*c+n*l;return[v(o,r)*d,v(i,m(r*r+o*o))*d]}:function(){return[r*d,o*d]};return O.distance=S,O}var J=function(){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=[],e=null;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((function(r){if(e){var o=180*(s=r,h=e,L[0]=s,L[1]=h,R(C))/Math.PI;if(o>t)for(var i=H(e,r),u=e.length>2||r.length>2?function(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}(e[2]||0,r[2]||0):null,c=u?function(t){return[].concat(a(i(t)),[u(t)])}:i,f=1/Math.ceil(o/t),l=f;l<1;)n.push(c(l)),l+=f}var s,h;n.push(e=r)})),n},q="undefined"!=typeof window&&window.THREE?window.THREE:{BufferGeometry:t.BufferGeometry,Float32BufferAttribute:t.Float32BufferAttribute},D=(new q.BufferGeometry).setAttribute?"setAttribute":"addAttribute",U=function(t){function n(t){var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n),(r=e(this,n)).type="GeoJsonGeometry",r.parameters={geoJson:t,radius:o,resolution:i};var a=({Point:h,MultiPoint:function(t,n){var e={vertices:[],indices:[]};return t.map((function(t){return h(t,n)})).forEach((function(t){var n=u(t,1)[0];$(e,n)})),[e]},LineString:d,MultiLineString:function(t,n){var e={vertices:[],indices:[]};return t.map((function(t){return d(t,n)})).forEach((function(t){var n=u(t,1)[0];$(e,n)})),[e]},Polygon:p,MultiPolygon:function(t,n){var e={vertices:[],indices:[]},r={vertices:[],indices:[]};t.map((function(t){return p(t,n)})).forEach((function(t){var n=u(t,2),o=n[0],i=n[1];$(e,o),i&&$(r,i)}));var o=[e];return r.vertices.length&&o.push(r),o}}[t.type]||function(){return[]})(t.coordinates,o),c=[],l=[],s=0;function h(t,n){return[{vertices:z(t[1],t[0],n+(t[2]||0)),indices:[]}]}function d(t,n){for(var e=f([J(t,i).map((function(t){var e=u(t,3),r=e[0],o=e[1],i=e[2];return z(o,r,n+(void 0===i?0:i))}))]).vertices,r=Math.round(e.length/3),o=[],a=1;a<r;a++)o.push(a-1,a);return[{vertices:e,indices:o}]}function p(t,n){for(var e=f(t.map((function(t){return J(t,i).map((function(t){var e=u(t,3),r=e[0],o=e[1],i=e[2];return z(o,r,n+(void 0===i?0:i))}))}))),r=e.vertices,o=e.holes,a=o[0]||1/0,c=r.slice(0,3*a),l=r.slice(3*a),s=new Set(o),h=Math.round(r.length/3),d=[],p=[],y=1;y<h;y++)s.has(y)||(y<a?d.push(y-1,y):p.push(y-1-a,y-a));var v=[{indices:d,vertices:c}];return o.length&&v.push({indices:p,vertices:l}),v}return a.forEach((function(t){var n=c.length;$({indices:c,vertices:l},t),r.addGroup(n,c.length-n,s++)})),c.length&&r.setIndex(c),l.length&&r[D]("position",new q.Float32BufferAttribute(l,3)),r}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&i(t,n)}(n,t),r=n,Object.defineProperty(r,"prototype",{writable:!1}),r;var r}(q.BufferGeometry);function $(t,n){var e=Math.round(t.vertices.length/3);k(t.vertices,n.vertices),k(t.indices,n.indices.map((function(t){return t+e})))}function k(t,n){var e,r=function(t,n){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=c(t))||n){e&&(t=e);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,u=!0,a=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==e.return||e.return()}finally{if(a)throw i}}}}(n);try{for(r.s();!(e=r.n()).done;){var o=e.value;t.push(o)}}catch(t){r.e(t)}finally{r.f()}}function z(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=(90-t)*Math.PI/180,o=(90-n)*Math.PI/180;return[e*Math.sin(r)*Math.cos(o),e*Math.cos(r),e*Math.sin(r)*Math.sin(o)]}return U}));
{
"name": "three-geojson-geometry",
"version": "2.0.0",
"version": "2.1.0",
"description": "ThreeJS geometry for stroking GeoJSON objects on a sphere",

@@ -48,2 +48,3 @@ "type": "module",

"d3-geo": "1 - 3",
"d3-interpolate": "1 - 3",
"earcut": "3"

@@ -58,8 +59,8 @@ },

"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-commonjs": "^28.0.2",
"@rollup/plugin-node-resolve": "^16.0.0",
"@rollup/plugin-terser": "^0.4.4",
"@types/three": ">=0.72.0",
"rimraf": "^6.0.1",
"rollup": "^4.28.1",
"rollup": "^4.29.1",
"rollup-plugin-dts": "^6.1.1",

@@ -66,0 +67,0 @@ "typescript": "^5.7.2"

@@ -38,5 +38,5 @@ ThreeJS GeoJSON Geometry

* <b>geoJson</b>: A GeoJson `geometry` object. It's recommended to split the geometries at the [anti-meridian](https://en.wikipedia.org/wiki/180th_meridian).
* <b>geoJson</b>: A GeoJson `geometry` object. It's recommended to split the geometries at the [anti-meridian](https://en.wikipedia.org/wiki/180th_meridian). Each `coordinates` point is expected to include longitude and latitude in that order. Altitude may be included as a third optional element, interpreted as elevation above the surface in regular cartesian units.
* <b>radius</b>: Radius of the sphere surface to draw the poygon on. Default is `1`.
* <b>resolution</b>: Resolution of the sphere, in lat/lng degrees. If the distance between two adjacent line points is larger than this value, the line segment will be interpolated in order to approximate the curvature of the sphere surface. Lower values yield more perfectly curved lines, at the cost of performance. Default is `5`.
* <b>resolution</b>: Resolution of the sphere, in lat/lng degrees. If the angular distance between two adjacent line points is larger than this value, the line segment will be interpolated in order to approximate the curvature of the sphere surface. Lower values yield more perfectly curved lines, at the cost of performance. Default is `5`.

@@ -43,0 +43,0 @@ ### Properties

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