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.1.2 to 1.1.3

2

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

@@ -147,3 +147,3 @@ 'use strict';

this.setIndex(indices);
this.addAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); //
this.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); //

@@ -150,0 +150,0 @@ function generateVertices(altitude) {

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

// Version 1.1.2 three-conic-polygon-geometry - https://github.com/vasturiano/three-conic-polygon-geometry
// Version 1.1.3 three-conic-polygon-geometry - https://github.com/vasturiano/three-conic-polygon-geometry
(function (global, factory) {

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

(global = global || self, factory(global.THREE = global.THREE || {}, global.THREE));
}(this, function (exports, three) { 'use strict';
}(this, (function (exports, three) { 'use strict';

@@ -195,3 +195,3 @@ function _slicedToArray(arr, i) {

} else if (pass === 1) {
ear = cureLocalIntersections(ear, triangles, dim);
ear = cureLocalIntersections(filterPoints(ear), triangles, dim);
earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);

@@ -303,3 +303,3 @@

return p;
return filterPoints(p);
}

@@ -397,3 +397,3 @@

if (hx === qx) return m.prev; // hole touches outer segment; pick lower endpoint
if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint

@@ -410,5 +410,5 @@ // look for points inside the triangle of hole point, segment intersection and endpoint;

p = m.next;
p = m;
while (p !== stop) {
do {
if (hx >= p.x && p.x >= mx && hx !== p.x &&

@@ -419,3 +419,4 @@ pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {

if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) {
if (locallyInside(p, hole) &&
(tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {
m = p;

@@ -427,3 +428,3 @@ tanMin = tan;

p = p.next;
}
} while (p !== stop);

@@ -433,2 +434,7 @@ return m;

// whether sector in vertex m contains sector in vertex p in the same coordinates
function sectorContainsSector(m, p) {
return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;
}
// interlink polygon nodes in z-order

@@ -543,4 +549,6 @@ function indexCurve(start, minX, minY, invSize) {

function isValidDiagonal(a, b) {
return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) &&
locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b);
return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges
(locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible
(area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case
}

@@ -560,8 +568,26 @@

function intersects(p1, q1, p2, q2) {
if ((equals(p1, q1) && equals(p2, q2)) ||
(equals(p1, q2) && equals(p2, q1))) return true;
return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 &&
area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0;
var o1 = sign(area(p1, q1, p2));
var o2 = sign(area(p1, q1, q2));
var o3 = sign(area(p2, q2, p1));
var o4 = sign(area(p2, q2, q1));
if (o1 !== o2 && o3 !== o4) return true; // general case
if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1
if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1
if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2
if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2
return false;
}
// for collinear points p, q, r, check if point q lies on segment pr
function onSegment(p, q, r) {
return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
}
function sign(num) {
return num > 0 ? 1 : num < 0 ? -1 : 0;
}
// check if a polygon diagonal intersects any polygon segments

@@ -805,3 +831,3 @@ function intersectsPolygon(a, b) {

this.setIndex(indices);
this.addAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); //
this.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); //

@@ -879,3 +905,3 @@ function generateVertices(altitude) {

}));
})));
//# sourceMappingURL=three-conic-polygon-geometry.js.map

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

// Version 1.1.2 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===j(e,t,n,r)>0)for(o=t;o<n;o+=r)x=A(o,e[o],e[o+1],x);else for(o=n-r;o>=t;o-=r)x=A(o,e[o],e[o+1],x);return x&&b(x,x.next)&&(B(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(B(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),B(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)&&G(i,o)&&G(o,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(o.i/n),B(r),B(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&&w(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 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 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 E(e.i,e.x,e.y),r=new E(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 A(e,t,n,r){var i=new E(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 B(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 E(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 j(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(j(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(j(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;var z=window.THREE?window.THREE:{BufferGeometry:t.BufferGeometry,Float32BufferAttribute:t.Float32BufferAttribute,Geometry:t.Geometry};function H(e,t,n,r,i,o){z.Geometry.call(this),this.type="ConicPolygonGeometry",this.parameters={polygonGeoJson:e,startHeight:t,endHeight:n,closedBottom:r,closedTop:i,includeSides:o},this.fromBufferGeometry(new T(e,t,n,r,i,o)),this.mergeVertices()}function T(e,t,o,x,u,f){z.BufferGeometry.call(this),this.type="ConicPolygonBufferGeometry",this.parameters={polygonGeoJson:e,startHeight:t,endHeight:o,closedBottom:x,closedTop:u,includeSides:f},o=o||1,x=void 0===x||x,u=void 0===u||u,f=void 0===f||f;var a=Z(t=t||0),y=a.vertices,v=a.holes,l=Z(o).vertices,p=Math.round(l.length/3),c=[].concat(r(l),r(y)),h=[],s=0;if(f){var d=h.length;h=h.concat(function(){for(var e=new Set(v),t=0,n=[],r=0;r<p;r++){var i=r+1;if(i===p)i=t;else if(e.has(i)){var o=i;i=t,t=o}n.push(r,r+p,i+p),n.push(i+p,i,r)}return n}()),this.addGroup(d,h.length-d,s++)}if(x){var g=h.length;h=h.concat(b(!1)),this.addGroup(g,h.length-g,s++)}if(u){var m=h.length;h=h.concat(b(!0)),this.addGroup(m,h.length-m,s++)}function Z(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,v,2);return!t&&(n=n.map((function(e){return e+p}))),n}this.setIndex(h),this.addAttribute("position",new z.Float32BufferAttribute(c,3))}H.prototype=Object.create(z.Geometry.prototype),H.prototype.constructor=H,T.prototype=Object.create(z.BufferGeometry.prototype),T.prototype.constructor=T,e.ConicPolygonBufferGeometry=T,e.ConicPolygonGeometry=H,Object.defineProperty(e,"__esModule",{value:!0})}));
// Version 1.1.3 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,d=u(e,0,s,n,!0),m=[];if(!d||d.next===d.prev)return m;if(p&&(d=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(g(y));for(v.sort(c),i=0;i<v.length;i++)h(v[i],n),n=f(n,n.next);return n}(e,t,d,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(d,m,n,r,i,l),m}function u(e,t,n,r,i){var o,x;if(i===T(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&&w(x,x.next)&&(z(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!==b(r.prev,r,r.next))r=r.next;else{if(z(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=d(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),z(e),e=c.next,h=c.next;else if((e=c)===h){x?1===x?a(e=l(f(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(b(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(m(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&b(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(b(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=d(u,f,t,n,r),l=d(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&&m(i.x,i.y,o.x,o.y,x.x,x.y,p.x,p.y)&&b(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,c!==e.prev&&c!==e.next&&m(i.x,i.y,o.x,o.y,x.x,x.y,c.x,c.y)&&b(c.prev,c,c.next)>=0)return!1;c=c.nextZ}for(;p&&p.z>=v;){if(p!==e.prev&&p!==e.next&&m(i.x,i.y,o.x,o.y,x.x,x.y,p.x,p.y)&&b(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;c&&c.z<=l;){if(c!==e.prev&&c!==e.next&&m(i.x,i.y,o.x,o.y,x.x,x.y,c.x,c.y)&&b(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)&&M(i,r,r.next,o)&&B(i,o)&&B(o,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(o.i/n),z(r),z(r.next),r=e=o),r=r.next}while(r!==e);return f(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&&Z(x,u)){var y=E(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;var f,a=n,y=n.x,v=n.y,l=1/0;r=n;do{i>=r.x&&r.x>=y&&i!==r.x&&m(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),B(r,e)&&(f<l||f===l&&(r.x>n.x||r.x===n.x&&s(n,r)))&&(n=r,l=f)),r=r.next}while(r!==a);return n}(e,t)){var n=E(t,e);f(n,n.next)}}function s(e,t){return b(e.prev,e,t.prev)<0&&b(t.next,e,e.next)<0}function d(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 g(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 m(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 Z(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&&M(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(B(e,t)&&B(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)&&(b(e.prev,e,t.prev)||b(e,t.prev,t))||w(e,t)&&b(e.prev,e,e.next)>0&&b(t.prev,t,t.next)>0)}function b(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 M(e,t,n,r){var i=A(b(e,t,n)),o=A(b(e,t,r)),x=A(b(n,r,e)),u=A(b(n,r,t));return i!==o&&x!==u||(!(0!==i||!G(e,n,t))||(!(0!==o||!G(e,r,t))||(!(0!==x||!G(n,e,r))||!(0!==u||!G(n,t,r)))))}function G(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function A(e){return e>0?1:e<0?-1:0}function B(e,t){return b(e.prev,e,e.next)<0?b(e,t,e.next)>=0&&b(e,e.prev,t)>=0:b(e,t,e.prev)<0||b(e,e.next,t)<0}function E(e,t){var n=new H(e.i,e.x,e.y),r=new H(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 H(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 z(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 H(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 T(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(T(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(T(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;var S=window.THREE?window.THREE:{BufferGeometry:t.BufferGeometry,Float32BufferAttribute:t.Float32BufferAttribute,Geometry:t.Geometry};function O(e,t,n,r,i,o){S.Geometry.call(this),this.type="ConicPolygonGeometry",this.parameters={polygonGeoJson:e,startHeight:t,endHeight:n,closedBottom:r,closedTop:i,includeSides:o},this.fromBufferGeometry(new P(e,t,n,r,i,o)),this.mergeVertices()}function P(e,t,o,x,u,f){S.BufferGeometry.call(this),this.type="ConicPolygonBufferGeometry",this.parameters={polygonGeoJson:e,startHeight:t,endHeight:o,closedBottom:x,closedTop:u,includeSides:f},o=o||1,x=void 0===x||x,u=void 0===u||u,f=void 0===f||f;var a=Z(t=t||0),y=a.vertices,v=a.holes,l=Z(o).vertices,p=Math.round(l.length/3),c=[].concat(r(l),r(y)),h=[],s=0;if(f){var d=h.length;h=h.concat(function(){for(var e=new Set(v),t=0,n=[],r=0;r<p;r++){var i=r+1;if(i===p)i=t;else if(e.has(i)){var o=i;i=t,t=o}n.push(r,r+p,i+p),n.push(i+p,i,r)}return n}()),this.addGroup(d,h.length-d,s++)}if(x){var g=h.length;h=h.concat(b(!1)),this.addGroup(g,h.length-g,s++)}if(u){var m=h.length;h=h.concat(b(!0)),this.addGroup(m,h.length-m,s++)}function Z(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,v,2);return!t&&(n=n.map((function(e){return e+p}))),n}this.setIndex(h),this.setAttribute("position",new S.Float32BufferAttribute(c,3))}O.prototype=Object.create(S.Geometry.prototype),O.prototype.constructor=O,P.prototype=Object.create(S.BufferGeometry.prototype),P.prototype.constructor=P,e.ConicPolygonBufferGeometry=P,e.ConicPolygonGeometry=O,Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -141,3 +141,3 @@ import { BufferGeometry, Float32BufferAttribute, Geometry } from 'three';

this.setIndex(indices);
this.addAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); //
this.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); //

@@ -144,0 +144,0 @@ function generateVertices(altitude) {

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

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

"dependencies": {
"earcut": "^2.1.5"
"earcut": "^2.2.1"
},

@@ -50,13 +50,13 @@ "peerDependencies": {

"devDependencies": {
"@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",
"@babel/core": "^7.7.2",
"@babel/plugin-proposal-class-properties": "^7.7.0",
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
"@babel/preset-env": "^7.7.1",
"rimraf": "^3.0.0",
"rollup": "^1.21.0",
"rollup": "^1.26.3",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"terser": "^4.3.0"
"terser": "^4.3.9"
}
}

@@ -89,3 +89,3 @@ import {

this.setIndex(indices);
this.addAttribute('position', new THREE.Float32BufferAttribute(vertices, 3));
this.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3));

@@ -92,0 +92,0 @@ //

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