three-conic-polygon-geometry
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -35,2 +35,6 @@ 'use strict'; | ||
function _iterableToArrayLimit(arr, i) { | ||
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { | ||
return; | ||
} | ||
var _arr = []; | ||
@@ -69,9 +73,2 @@ var _n = true; | ||
var THREE = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists | ||
: { | ||
BufferGeometry: three.BufferGeometry, | ||
Float32BufferAttribute: three.Float32BufferAttribute, | ||
Geometry: three.Geometry | ||
}; | ||
function ConicPolygonGeometry(polygonGeoJson, startHeight, endHeight, closedBottom, closedTop, includeSides) { | ||
@@ -78,0 +75,0 @@ three.Geometry.call(this); |
@@ -1,2 +0,2 @@ | ||
// Version 1.1.0 three-conic-polygon-geometry - https://github.com/vasturiano/three-conic-polygon-geometry | ||
// Version 1.1.1 three-conic-polygon-geometry - https://github.com/vasturiano/three-conic-polygon-geometry | ||
(function (global, factory) { | ||
@@ -33,2 +33,6 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three')) : | ||
function _iterableToArrayLimit(arr, i) { | ||
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { | ||
return; | ||
} | ||
var _arr = []; | ||
@@ -717,9 +721,2 @@ var _n = true; | ||
var THREE = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists | ||
: { | ||
BufferGeometry: three.BufferGeometry, | ||
Float32BufferAttribute: three.Float32BufferAttribute, | ||
Geometry: three.Geometry | ||
}; | ||
function ConicPolygonGeometry(polygonGeoJson, startHeight, endHeight, closedBottom, closedTop, includeSides) { | ||
@@ -726,0 +723,0 @@ three.Geometry.call(this); |
@@ -1,2 +0,2 @@ | ||
// Version 1.1.0 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 n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var x,u=e[Symbol.iterator]();!(r=(x=u.next()).done)&&(n.push(x.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function r(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var i=x,o=x;function x(e,t,n){n=n||2;var r,i,o,x,y,v,l,p=t&&t.length,s=p?t[0]*n:e.length,g=u(e,0,s,n,!0),m=[];if(!g||g.next===g.prev)return m;if(p&&(g=function(e,t,n,r){var i,o,x,a,y,v=[];for(i=0,o=t.length;i<o;i++)x=t[i]*r,a=i<o-1?t[i+1]*r:e.length,(y=u(e,x,a,r,!1))===y.next&&(y.steiner=!0),v.push(d(y));for(v.sort(c),i=0;i<v.length;i++)h(v[i],n),n=f(n,n.next);return n}(e,t,g,n)),e.length>80*n){r=o=e[0],i=x=e[1];for(var Z=n;Z<s;Z+=n)(y=e[Z])<r&&(r=y),(v=e[Z+1])<i&&(i=v),y>o&&(o=y),v>x&&(x=v);l=0!==(l=Math.max(o-r,x-i))?1/l:0}return a(g,m,n,r,i,l),m}function u(e,t,n,r,i){var o,x;if(i===z(e,t,n,r)>0)for(o=t;o<n;o+=r)x=E(o,e[o],e[o+1],x);else for(o=n-r;o>=t;o-=r)x=E(o,e[o],e[o+1],x);return x&&w(x,x.next)&&(A(x),x=x.next),x}function f(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!w(r,r.next)&&0!==Z(r.prev,r,r.next))r=r.next;else{if(A(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function a(e,t,n,r,i,o,x){if(e){!x&&o&&function(e,t,n,r){var i=e;do{null===i.z&&(i.z=s(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,x,u,f,a=1;do{for(n=e,e=null,o=null,x=0;n;){for(x++,r=n,u=0,t=0;t<a&&(u++,r=r.nextZ);t++);for(f=a;u>0||f>0&&r;)0!==u&&(0===f||!r||n.z<=r.z)?(i=n,n=n.nextZ,u--):(i=r,r=r.nextZ,f--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;n=r}o.nextZ=null,a*=2}while(x>1)}(i)}(e,r,i,o);for(var u,c,h=e;e.prev!==e.next;)if(u=e.prev,c=e.next,o?v(e,r,i,o):y(e))t.push(u.i/n),t.push(e.i/n),t.push(c.i/n),A(e),e=c.next,h=c.next;else if((e=c)===h){x?1===x?a(e=l(e,t,n),t,n,r,i,o,2):2===x&&p(e,t,n,r,i,o):a(f(e),t,n,r,i,o,1);break}}}function y(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(g(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 v(e,t,n,r){var i=e.prev,o=e,x=e.next;if(Z(i,o,x)>=0)return!1;for(var u=i.x<o.x?i.x<x.x?i.x:x.x:o.x<x.x?o.x:x.x,f=i.y<o.y?i.y<x.y?i.y:x.y:o.y<x.y?o.y:x.y,a=i.x>o.x?i.x>x.x?i.x:x.x:o.x>x.x?o.x:x.x,y=i.y>o.y?i.y>x.y?i.y:x.y:o.y>x.y?o.y:x.y,v=s(u,f,t,n,r),l=s(a,y,t,n,r),p=e.prevZ,c=e.nextZ;p&&p.z>=v&&c&&c.z<=l;){if(p!==e.prev&&p!==e.next&&g(i.x,i.y,o.x,o.y,x.x,x.y,p.x,p.y)&&Z(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,c!==e.prev&&c!==e.next&&g(i.x,i.y,o.x,o.y,x.x,x.y,c.x,c.y)&&Z(c.prev,c,c.next)>=0)return!1;c=c.nextZ}for(;p&&p.z>=v;){if(p!==e.prev&&p!==e.next&&g(i.x,i.y,o.x,o.y,x.x,x.y,p.x,p.y)&&Z(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;c&&c.z<=l;){if(c!==e.prev&&c!==e.next&&g(i.x,i.y,o.x,o.y,x.x,x.y,c.x,c.y)&&Z(c.prev,c,c.next)>=0)return!1;c=c.nextZ}return!0}function l(e,t,n){var r=e;do{var i=r.prev,o=r.next.next;!w(i,o)&&b(i,r,r.next,o)&&G(i,o)&&G(o,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(o.i/n),A(r),A(r.next),r=e=o),r=r.next}while(r!==e);return r}function p(e,t,n,r,i,o){var x=e;do{for(var u=x.next.next;u!==x.prev;){if(x.i!==u.i&&m(x,u)){var y=M(x,u);return x=f(x,x.next),y=f(y,y.next),a(x,t,n,r,i,o),void a(y,t,n,r,i,o)}u=u.next}x=x.next}while(x!==e)}function c(e,t){return e.x-t.x}function h(e,t){if(t=function(e,t){var n,r=t,i=e.x,o=e.y,x=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var u=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(u<=i&&u>x){if(x=u,u===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===x)return n.prev;var f,a=n,y=n.x,v=n.y,l=1/0;r=n.next;for(;r!==a;)i>=r.x&&r.x>=y&&i!==r.x&&g(o<v?i:x,o,y,v,o<v?x:i,o,r.x,r.y)&&((f=Math.abs(o-r.y)/(i-r.x))<l||f===l&&r.x>n.x)&&G(r,e)&&(n=r,l=f),r=r.next;return n}(e,t)){var n=M(t,e);f(n,n.next)}}function s(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 d(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 g(e,t,n,r,i,o,x,u){return(i-x)*(t-u)-(e-x)*(o-u)>=0&&(e-x)*(r-u)-(n-x)*(t-u)>=0&&(n-x)*(o-u)-(i-x)*(r-u)>=0}function m(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&&b(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&G(e,t)&&G(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 w(e,t){return e.x===t.x&&e.y===t.y}function b(e,t,n,r){return!!(w(e,t)&&w(n,r)||w(e,r)&&w(n,t))||Z(e,t,n)>0!=Z(e,t,r)>0&&Z(n,r,e)>0!=Z(n,r,t)>0}function G(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 M(e,t){var n=new B(e.i,e.x,e.y),r=new B(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 B(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 A(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 B(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 z(e,t,n,r){for(var i=0,o=t,x=n-r;o<n;o+=r)i+=(e[x]-e[o])*(e[o+1]+e[x+1]),x=o;return i}x.deviation=function(e,t,n,r){var i=t&&t.length,o=i?t[0]*n:e.length,x=Math.abs(z(e,0,o,n));if(i)for(var u=0,f=t.length;u<f;u++){var a=t[u]*n,y=u<f-1?t[u+1]*n:e.length;x-=Math.abs(z(e,a,y,n))}var v=0;for(u=0;u<r.length;u+=3){var l=r[u]*n,p=r[u+1]*n,c=r[u+2]*n;v+=Math.abs((e[l]-e[c])*(e[p+1]-e[l+1])-(e[l]-e[p])*(e[c+1]-e[l+1]))}return 0===x&&0===v?0:Math.abs((v-x)/x)},x.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 x=0;x<t;x++)n.vertices.push(e[i][o][x]);i>0&&(r+=e[i-1].length,n.holes.push(r))}return n},i.default=o;window.THREE?window.THREE:(t.BufferGeometry,t.Float32BufferAttribute,t.Geometry);function H(e,n,r,i,o,x){t.Geometry.call(this),this.type="ConicPolygonGeometry",this.parameters={polygonGeoJson:e,startHeight:n,endHeight:r,closedBottom:i,closedTop:o,includeSides:x},this.fromBufferGeometry(new T(e,n,r,i,o,x)),this.mergeVertices()}function T(e,o,x,u,f,a){t.BufferGeometry.call(this),this.type="ConicPolygonBufferGeometry",this.parameters={polygonGeoJson:e,startHeight:o,endHeight:x,closedBottom:u,closedTop:f,includeSides:a},x=x||1,u=void 0===u||u,f=void 0===f||f,a=void 0===a||a;var y=w(o=o||0),v=y.vertices,l=y.holes,p=w(x).vertices,c=Math.round(p.length/3),h=[].concat(r(p),r(v)),s=[],d=0;if(a){var g=s.length;s=s.concat(function(){for(var e=new Set(l),t=0,n=[],r=0;r<c;r++){var i=r+1;if(i===c)i=t;else if(e.has(i)){var o=i;i=t,t=o}n.push(r,r+c,i+c),n.push(i+c,i,r)}return n}()),this.addGroup(g,s.length-g,d++)}if(u){var m=s.length;s=s.concat(b(!1)),this.addGroup(m,s.length-m,d++)}if(f){var Z=s.length;s=s.concat(b(!0)),this.addGroup(Z,s.length-Z,d++)}function w(t){var r=e.map(function(e){return e.map(function(e){var r=n(e,2),i=r[0];return function(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)]}(r[1],i,t)})});return i.flatten(r)}function b(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=i(i.flatten(e).vertices,l,2);return!t&&(n=n.map(function(e){return e+c})),n}this.setIndex(s),this.addAttribute("position",new t.Float32BufferAttribute(h,3))}H.prototype=Object.create(t.Geometry.prototype),H.prototype.constructor=H,T.prototype=Object.create(t.BufferGeometry.prototype),T.prototype.constructor=T,e.ConicPolygonBufferGeometry=T,e.ConicPolygonGeometry=H,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
// Version 1.1.1 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 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 x,u=e[Symbol.iterator]();!(r=(x=u.next()).done)&&(n.push(x.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function r(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var i=x,o=x;function x(e,t,n){n=n||2;var r,i,o,x,y,v,l,p=t&&t.length,s=p?t[0]*n:e.length,g=u(e,0,s,n,!0),m=[];if(!g||g.next===g.prev)return m;if(p&&(g=function(e,t,n,r){var i,o,x,a,y,v=[];for(i=0,o=t.length;i<o;i++)x=t[i]*r,a=i<o-1?t[i+1]*r:e.length,(y=u(e,x,a,r,!1))===y.next&&(y.steiner=!0),v.push(d(y));for(v.sort(c),i=0;i<v.length;i++)h(v[i],n),n=f(n,n.next);return n}(e,t,g,n)),e.length>80*n){r=o=e[0],i=x=e[1];for(var Z=n;Z<s;Z+=n)(y=e[Z])<r&&(r=y),(v=e[Z+1])<i&&(i=v),y>o&&(o=y),v>x&&(x=v);l=0!==(l=Math.max(o-r,x-i))?1/l:0}return a(g,m,n,r,i,l),m}function u(e,t,n,r,i){var o,x;if(i===B(e,t,n,r)>0)for(o=t;o<n;o+=r)x=j(o,e[o],e[o+1],x);else for(o=n-r;o>=t;o-=r)x=j(o,e[o],e[o+1],x);return x&&b(x,x.next)&&(A(x),x=x.next),x}function f(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!b(r,r.next)&&0!==Z(r.prev,r,r.next))r=r.next;else{if(A(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function a(e,t,n,r,i,o,x){if(e){!x&&o&&function(e,t,n,r){var i=e;do{null===i.z&&(i.z=s(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,x,u,f,a=1;do{for(n=e,e=null,o=null,x=0;n;){for(x++,r=n,u=0,t=0;t<a&&(u++,r=r.nextZ);t++);for(f=a;u>0||f>0&&r;)0!==u&&(0===f||!r||n.z<=r.z)?(i=n,n=n.nextZ,u--):(i=r,r=r.nextZ,f--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;n=r}o.nextZ=null,a*=2}while(x>1)}(i)}(e,r,i,o);for(var u,c,h=e;e.prev!==e.next;)if(u=e.prev,c=e.next,o?v(e,r,i,o):y(e))t.push(u.i/n),t.push(e.i/n),t.push(c.i/n),A(e),e=c.next,h=c.next;else if((e=c)===h){x?1===x?a(e=l(e,t,n),t,n,r,i,o,2):2===x&&p(e,t,n,r,i,o):a(f(e),t,n,r,i,o,1);break}}}function y(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(g(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 v(e,t,n,r){var i=e.prev,o=e,x=e.next;if(Z(i,o,x)>=0)return!1;for(var u=i.x<o.x?i.x<x.x?i.x:x.x:o.x<x.x?o.x:x.x,f=i.y<o.y?i.y<x.y?i.y:x.y:o.y<x.y?o.y:x.y,a=i.x>o.x?i.x>x.x?i.x:x.x:o.x>x.x?o.x:x.x,y=i.y>o.y?i.y>x.y?i.y:x.y:o.y>x.y?o.y:x.y,v=s(u,f,t,n,r),l=s(a,y,t,n,r),p=e.prevZ,c=e.nextZ;p&&p.z>=v&&c&&c.z<=l;){if(p!==e.prev&&p!==e.next&&g(i.x,i.y,o.x,o.y,x.x,x.y,p.x,p.y)&&Z(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,c!==e.prev&&c!==e.next&&g(i.x,i.y,o.x,o.y,x.x,x.y,c.x,c.y)&&Z(c.prev,c,c.next)>=0)return!1;c=c.nextZ}for(;p&&p.z>=v;){if(p!==e.prev&&p!==e.next&&g(i.x,i.y,o.x,o.y,x.x,x.y,p.x,p.y)&&Z(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;c&&c.z<=l;){if(c!==e.prev&&c!==e.next&&g(i.x,i.y,o.x,o.y,x.x,x.y,c.x,c.y)&&Z(c.prev,c,c.next)>=0)return!1;c=c.nextZ}return!0}function l(e,t,n){var r=e;do{var i=r.prev,o=r.next.next;!b(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),A(r),A(r.next),r=e=o),r=r.next}while(r!==e);return r}function p(e,t,n,r,i,o){var x=e;do{for(var u=x.next.next;u!==x.prev;){if(x.i!==u.i&&m(x,u)){var y=G(x,u);return x=f(x,x.next),y=f(y,y.next),a(x,t,n,r,i,o),void a(y,t,n,r,i,o)}u=u.next}x=x.next}while(x!==e)}function c(e,t){return e.x-t.x}function h(e,t){if(t=function(e,t){var n,r=t,i=e.x,o=e.y,x=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var u=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(u<=i&&u>x){if(x=u,u===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===x)return n.prev;var f,a=n,y=n.x,v=n.y,l=1/0;r=n.next;for(;r!==a;)i>=r.x&&r.x>=y&&i!==r.x&&g(o<v?i:x,o,y,v,o<v?x: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=G(t,e);f(n,n.next)}}function s(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 d(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 g(e,t,n,r,i,o,x,u){return(i-x)*(t-u)-(e-x)*(o-u)>=0&&(e-x)*(r-u)-(n-x)*(t-u)>=0&&(n-x)*(o-u)-(i-x)*(r-u)>=0}function m(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 b(e,t){return e.x===t.x&&e.y===t.y}function w(e,t,n,r){return!!(b(e,t)&&b(n,r)||b(e,r)&&b(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 G(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 j(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 A(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 B(e,t,n,r){for(var i=0,o=t,x=n-r;o<n;o+=r)i+=(e[x]-e[o])*(e[o+1]+e[x+1]),x=o;return i}function E(e,n,r,i,o,x){t.Geometry.call(this),this.type="ConicPolygonGeometry",this.parameters={polygonGeoJson:e,startHeight:n,endHeight:r,closedBottom:i,closedTop:o,includeSides:x},this.fromBufferGeometry(new S(e,n,r,i,o,x)),this.mergeVertices()}function S(e,o,x,u,f,a){t.BufferGeometry.call(this),this.type="ConicPolygonBufferGeometry",this.parameters={polygonGeoJson:e,startHeight:o,endHeight:x,closedBottom:u,closedTop:f,includeSides:a},x=x||1,u=void 0===u||u,f=void 0===f||f,a=void 0===a||a;var y=b(o=o||0),v=y.vertices,l=y.holes,p=b(x).vertices,c=Math.round(p.length/3),h=[].concat(r(p),r(v)),s=[],d=0;if(a){var g=s.length;s=s.concat(function(){for(var e=new Set(l),t=0,n=[],r=0;r<c;r++){var i=r+1;if(i===c)i=t;else if(e.has(i)){var o=i;i=t,t=o}n.push(r,r+c,i+c),n.push(i+c,i,r)}return n}()),this.addGroup(g,s.length-g,d++)}if(u){var m=s.length;s=s.concat(w(!1)),this.addGroup(m,s.length-m,d++)}if(f){var Z=s.length;s=s.concat(w(!0)),this.addGroup(Z,s.length-Z,d++)}function b(t){var r=e.map((function(e){return e.map((function(e){var r=n(e,2),i=r[0];return function(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)]}(r[1],i,t)}))}));return i.flatten(r)}function w(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=i(i.flatten(e).vertices,l,2);return!t&&(n=n.map((function(e){return e+c}))),n}this.setIndex(s),this.addAttribute("position",new t.Float32BufferAttribute(h,3))}x.deviation=function(e,t,n,r){var i=t&&t.length,o=i?t[0]*n:e.length,x=Math.abs(B(e,0,o,n));if(i)for(var u=0,f=t.length;u<f;u++){var a=t[u]*n,y=u<f-1?t[u+1]*n:e.length;x-=Math.abs(B(e,a,y,n))}var v=0;for(u=0;u<r.length;u+=3){var l=r[u]*n,p=r[u+1]*n,c=r[u+2]*n;v+=Math.abs((e[l]-e[c])*(e[p+1]-e[l+1])-(e[l]-e[p])*(e[c+1]-e[l+1]))}return 0===x&&0===v?0:Math.abs((v-x)/x)},x.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 x=0;x<t;x++)n.vertices.push(e[i][o][x]);i>0&&(r+=e[i-1].length,n.holes.push(r))}return n},i.default=o,E.prototype=Object.create(t.Geometry.prototype),E.prototype.constructor=E,S.prototype=Object.create(t.BufferGeometry.prototype),S.prototype.constructor=S,e.ConicPolygonBufferGeometry=S,e.ConicPolygonGeometry=E,Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -1,2 +0,2 @@ | ||
import { BufferGeometry, Float32BufferAttribute, Geometry } from 'three'; | ||
import { Geometry, BufferGeometry, Float32BufferAttribute } from 'three'; | ||
import earcut from 'earcut'; | ||
@@ -29,2 +29,6 @@ | ||
function _iterableToArrayLimit(arr, i) { | ||
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { | ||
return; | ||
} | ||
var _arr = []; | ||
@@ -63,9 +67,2 @@ var _n = true; | ||
var THREE = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists | ||
: { | ||
BufferGeometry: BufferGeometry, | ||
Float32BufferAttribute: Float32BufferAttribute, | ||
Geometry: Geometry | ||
}; | ||
function ConicPolygonGeometry(polygonGeoJson, startHeight, endHeight, closedBottom, closedTop, includeSides) { | ||
@@ -72,0 +69,0 @@ Geometry.call(this); |
{ | ||
"name": "three-conic-polygon-geometry", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "ThreeJS geometry for drawing polygons on a sphere", | ||
@@ -49,13 +49,13 @@ "unpkg": "dist/three-conic-polygon-geometry.min.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.4.5", | ||
"@babel/plugin-proposal-class-properties": "^7.4.4", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.4.4", | ||
"@babel/preset-env": "^7.4.5", | ||
"rimraf": "^2.6.3", | ||
"rollup": "^1.12.4", | ||
"rollup-plugin-babel": "^4.3.2", | ||
"rollup-plugin-commonjs": "^10.0.0", | ||
"rollup-plugin-node-resolve": "^5.0.0", | ||
"terser": "^4.0.0" | ||
"@babel/core": "^7.6.0", | ||
"@babel/plugin-proposal-class-properties": "^7.5.5", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.5.5", | ||
"@babel/preset-env": "^7.6.0", | ||
"rimraf": "^3.0.0", | ||
"rollup": "^1.21.0", | ||
"rollup-plugin-babel": "^4.3.3", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"terser": "^4.3.0" | ||
} | ||
} |
@@ -1,3 +0,8 @@ | ||
# ThreeJS Conic Polygon Geometry | ||
ThreeJS Conic Polygon Geometry | ||
============== | ||
[![NPM package][npm-img]][npm-url] | ||
[![Build Size][build-size-img]][build-size-url] | ||
[![Dependencies][dependencies-img]][dependencies-url] | ||
A ThreeJS geometry class for drawing polygons on a sphere using cones. | ||
@@ -7,4 +12,2 @@ | ||
[![NPM](https://nodei.co/npm/data-joint.png?compact=true)](https://nodei.co/npm/data-joint/) | ||
<p align="center"> | ||
@@ -46,3 +49,3 @@ <a href="//vasturiano.github.io/three-conic-polygon-geometry/example/countries-gdp-per-capita/"><img width="80%" src="https://vasturiano.github.io/three-conic-polygon-geometry/example/countries-gdp-per-capita/preview.png"></a> | ||
* <b>polygonGeoJson</b>: Coordinates array as specified in GeoJson `geometry.coordinates` for `type: Polygon`. The first item is the polygon contour, additional items are the inner holes. | ||
* <b>polygonGeoJson</b>: Coordinates array as specified in GeoJson `geometry.coordinates` for `type: Polygon`. The first item is the polygon contour, additional items are the inner holes. It's recommended to split the geometries at the [anti-meridian](https://en.wikipedia.org/wiki/180th_meridian). | ||
* <b>bottomHeight</b>: Starting height of the cone. Default is `0`. | ||
@@ -67,1 +70,9 @@ * <b>topHeight</b>: Ending height of the cone. Default is `1`. | ||
* <b>2</b>: The top surface of the cone. | ||
[npm-img]: https://img.shields.io/npm/v/three-conic-polygon-geometry.svg | ||
[npm-url]: https://npmjs.org/package/three-conic-polygon-geometry | ||
[build-size-img]: https://img.shields.io/bundlephobia/minzip/three-conic-polygon-geometry.svg | ||
[build-size-url]: https://bundlephobia.com/result?p=three-conic-polygon-geometry | ||
[dependencies-img]: https://img.shields.io/david/vasturiano/three-conic-polygon-geometry.svg | ||
[dependencies-url]: https://david-dm.org/vasturiano/three-conic-polygon-geometry |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
703353
76
1136