@thi.ng/geom-poly-utils
Advanced tools
Comparing version 0.1.26 to 0.1.27
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.1.27](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-poly-utils@0.1.26...@thi.ng/geom-poly-utils@0.1.27) (2019-11-09) | ||
**Note:** Version bump only for package @thi.ng/geom-poly-utils | ||
## [0.1.26](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-poly-utils@0.1.25...@thi.ng/geom-poly-utils@0.1.26) (2019-09-21) | ||
@@ -8,0 +16,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@thi.ng/vectors"),require("@thi.ng/errors"),require("@thi.ng/math")):"function"==typeof define&&define.amd?define(["exports","@thi.ng/vectors","@thi.ng/errors","@thi.ng/math"],e):e(((t=t||self).thi=t.thi||{},t.thi.ng=t.thi.ng||{},t.thi.ng.geomPolyUtils={}),t.thi.ng.vectors,t.thi.ng.errors,t.thi.ng.math)}(this,function(t,e,r,n){"use strict";const i=e.signedArea2;t.bounds=(t,r,n)=>{for(let i=t.length;--i>=0;){const o=t[i];e.min(null,r,o),e.max(null,n,o)}return[r,n]},t.centerOfWeight2=(t,r=[])=>{const n=t.length-1;let i=0,o=0,s=0,l=t[n],u=t[0];for(let r=0;r<=n;l=u,u=t[++r]){const t=e.cross2(l,u);i+=t,o+=(l[0]+u[0])*t,s+=(l[1]+u[1])*t}return i=1/(3*i),r[0]=o*i,r[1]=s*i,r},t.centroid=(t,n)=>{const i=t.length;!i&&r.illegalArgs("no points"),!n&&(n=e.empty(t[0]));for(let r=i;--r>=0;)e.add(n,n,t[r]);return e.divN(n,n,i)},t.circumCenter2=(t,e,r,i=n.EPS)=>{const o=t[0],s=t[1],l=e[0],u=e[1],c=r[0],a=r[1],h=l-o,g=u-s,d=c-l,f=a-u,m=Math.abs(g),p=Math.abs(f);if(m<i&&p<i||Math.abs(h)<i&&Math.abs(d)<i)return;let b,y,q,v,M,x,P,A;const C=(o+l)/2,S=(s+u)/2,W=(l+c)/2,_=(u+a)/2;return m<i?A=(y=-d/f)*((P=C)-(v=W))+(x=_):p<i?A=(b=-h/g)*((P=W)-(q=C))+(M=S):(P=((b=-h/g)*(q=C)-(y=-d/f)*(v=W)+(x=_)-(M=S))/(b-y),A=m>p?b*(P-q)+M:y*(P-v)+x),[P,A]},t.convexity=(t,r=n.EPS)=>{let i=t.length;if(i<3)return i<2?-1:0;let o=0,s=t[i-2],l=t[i-1],u=t[0];for(let n=0;n<i;s=l,l=u,u=t[++n]){const t=e.corner2(s,l,u,r);if(t<0?o|=1:t>0&&(o|=2),3===o)return 2}return o>0?1:0},t.equilateralTriangle2=(t,r)=>{const i=e.sub2([],r,t),o=e.normalize(null,e.perpendicularCCW([],i),e.mag(i)*Math.sin(n.THIRD_PI));return[t,r,e.maddN2(null,i,.5,o)]},t.fromBarycentric=(t,r,n,i,o=[])=>e.addW3(o,t,r,n,i[0],i[1],i[2]),t.perimeter=(t,r=t.length,n=!1)=>{if(r<2)return 0;let i=0,o=t[0],s=t[1];for(let n=1;n<r;o=s,s=t[++n])i+=e.dist(o,s);return n?i+e.dist(o,t[0]):i},t.polyArea2=t=>{const r=t.length-1;if(r<2)return 0;let n=0,i=t[r],o=t[0];for(let s=0;s<=r;i=o,o=t[++s])n+=e.cross2(i,o);return n/2},t.toBarycentric=(t,r,n,i,o=[])=>{const s=e.sub([],r,t),l=e.sub([],n,t),u=e.sub([],i,t),c=e.magSq(s),a=e.magSq(l),h=e.dot(s,l),g=e.dot(s,u),d=e.dot(l,u),f=1/(h*h-c*a),m=f*(h*d-a*g),p=f*(h*g-c*d);return e.setC3(o,1-(m+p),m,p)},t.triArea2=i,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@thi.ng/vectors"),require("@thi.ng/errors"),require("@thi.ng/math")):"function"==typeof define&&define.amd?define(["exports","@thi.ng/vectors","@thi.ng/errors","@thi.ng/math"],e):e(((t=t||self).thi=t.thi||{},t.thi.ng=t.thi.ng||{},t.thi.ng.geomPolyUtils={}),t.thi.ng.vectors,t.thi.ng.errors,t.thi.ng.math)}(this,(function(t,e,r,n){"use strict";const i=e.signedArea2;t.bounds=(t,r,n)=>{for(let i=t.length;--i>=0;){const o=t[i];e.min(null,r,o),e.max(null,n,o)}return[r,n]},t.centerOfWeight2=(t,r=[])=>{const n=t.length-1;let i=0,o=0,s=0,l=t[n],u=t[0];for(let r=0;r<=n;l=u,u=t[++r]){const t=e.cross2(l,u);i+=t,o+=(l[0]+u[0])*t,s+=(l[1]+u[1])*t}return i=1/(3*i),r[0]=o*i,r[1]=s*i,r},t.centroid=(t,n)=>{const i=t.length;!i&&r.illegalArgs("no points"),!n&&(n=e.empty(t[0]));for(let r=i;--r>=0;)e.add(n,n,t[r]);return e.divN(n,n,i)},t.circumCenter2=(t,e,r,i=n.EPS)=>{const o=t[0],s=t[1],l=e[0],u=e[1],c=r[0],a=r[1],h=l-o,g=u-s,d=c-l,f=a-u,m=Math.abs(g),p=Math.abs(f);if(m<i&&p<i||Math.abs(h)<i&&Math.abs(d)<i)return;let b,y,q,v,M,x,P,A;const C=(o+l)/2,S=(s+u)/2,W=(l+c)/2,_=(u+a)/2;return m<i?A=(y=-d/f)*((P=C)-(v=W))+(x=_):p<i?A=(b=-h/g)*((P=W)-(q=C))+(M=S):(P=((b=-h/g)*(q=C)-(y=-d/f)*(v=W)+(x=_)-(M=S))/(b-y),A=m>p?b*(P-q)+M:y*(P-v)+x),[P,A]},t.convexity=(t,r=n.EPS)=>{let i=t.length;if(i<3)return i<2?-1:0;let o=0,s=t[i-2],l=t[i-1],u=t[0];for(let n=0;n<i;s=l,l=u,u=t[++n]){const t=e.corner2(s,l,u,r);if(t<0?o|=1:t>0&&(o|=2),3===o)return 2}return o>0?1:0},t.equilateralTriangle2=(t,r)=>{const i=e.sub2([],r,t),o=e.normalize(null,e.perpendicularCCW([],i),e.mag(i)*Math.sin(n.THIRD_PI));return[t,r,e.maddN2(null,i,.5,o)]},t.fromBarycentric=(t,r,n,i,o=[])=>e.addW3(o,t,r,n,i[0],i[1],i[2]),t.perimeter=(t,r=t.length,n=!1)=>{if(r<2)return 0;let i=0,o=t[0],s=t[1];for(let n=1;n<r;o=s,s=t[++n])i+=e.dist(o,s);return n?i+e.dist(o,t[0]):i},t.polyArea2=t=>{const r=t.length-1;if(r<2)return 0;let n=0,i=t[r],o=t[0];for(let s=0;s<=r;i=o,o=t[++s])n+=e.cross2(i,o);return n/2},t.toBarycentric=(t,r,n,i,o=[])=>{const s=e.sub([],r,t),l=e.sub([],n,t),u=e.sub([],i,t),c=e.magSq(s),a=e.magSq(l),h=e.dot(s,l),g=e.dot(s,u),d=e.dot(l,u),f=1/(h*h-c*a),m=f*(h*d-a*g),p=f*(h*g-c*d);return e.setC3(o,1-(m+p),m,p)},t.triArea2=i,Object.defineProperty(t,"__esModule",{value:!0})})); |
{ | ||
"name": "@thi.ng/geom-poly-utils", | ||
"version": "0.1.26", | ||
"version": "0.1.27", | ||
"description": "Polygon / triangle analysis & processing utilities", | ||
@@ -32,10 +32,10 @@ "module": "./index.js", | ||
"nyc": "^14.0.0", | ||
"typedoc": "^0.14.2", | ||
"typescript": "^3.5.3" | ||
"typedoc": "^0.15.0", | ||
"typescript": "^3.6.4" | ||
}, | ||
"dependencies": { | ||
"@thi.ng/errors": "^1.2.0", | ||
"@thi.ng/geom-api": "^0.3.6", | ||
"@thi.ng/math": "^1.4.2", | ||
"@thi.ng/vectors": "^3.3.1" | ||
"@thi.ng/errors": "^1.2.1", | ||
"@thi.ng/geom-api": "^0.3.7", | ||
"@thi.ng/math": "^1.5.0", | ||
"@thi.ng/vectors": "^4.0.0" | ||
}, | ||
@@ -61,3 +61,3 @@ "keywords": [ | ||
"sideEffects": false, | ||
"gitHead": "5f865588e37a27ceb46484c24fce4d59a0637f90" | ||
"gitHead": "97add769f24aa32a1a5e13c5c941605e1b9eb569" | ||
} |
50351
- Removed@thi.ng/arrays@0.2.5(transitive)
- Removed@thi.ng/binary@1.3.2(transitive)
- Removed@thi.ng/hex@0.2.7(transitive)
- Removed@thi.ng/memoize@1.1.8(transitive)
- Removed@thi.ng/random@1.4.17(transitive)
- Removed@thi.ng/strings@1.15.6(transitive)
- Removed@thi.ng/transducers@5.4.5(transitive)
- Removed@thi.ng/vectors@3.3.1(transitive)
Updated@thi.ng/errors@^1.2.1
Updated@thi.ng/geom-api@^0.3.7
Updated@thi.ng/math@^1.5.0
Updated@thi.ng/vectors@^4.0.0