package.umd.incircle.min.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of robust-predicates Show documentation
Show all versions of robust-predicates Show documentation
Fast robust predicates for computational geometry
The newest version!
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).predicates={})}(this,(function(t){"use strict";const n=134217729;function e(t,n,e,o,f){let i,r,c,s,u=n[0],a=o[0],l=0,d=0;a>u==a>-u?(i=u,u=n[++l]):(i=a,a=o[++d]);let b=0;if(lu==a>-u?(r=u+i,c=i-(r-u),u=n[++l]):(r=a+i,c=i-(r-a),a=o[++d]),i=r,0!==c&&(f[b++]=c);lu==a>-u?(r=i+u,s=r-i,c=i-(r-s)+(u-s),u=n[++l]):(r=i+a,s=r-i,c=i-(r-s)+(a-s),a=o[++d]),i=r,0!==c&&(f[b++]=c);for(;lit||-ot>it?ot:function(t,i,D,G,H,I,J,K,L){let N,Q,R,S,U,V,W,X,Y,Z,$,tt,nt,et,ot,ft,it,rt,ct,st,ut,at,lt,dt,bt,ht,pt,Mt,yt,xt,gt,jt,mt,Tt,_t;const vt=t-J,wt=D-J,At=H-J,Ft=i-K,Ot=G-K,Pt=I-K;gt=wt*Pt,lt=n*wt,dt=lt-(lt-wt),bt=wt-dt,lt=n*Pt,ht=lt-(lt-Pt),pt=Pt-ht,jt=bt*pt-(gt-dt*ht-bt*ht-dt*pt),mt=At*Ot,lt=n*At,dt=lt-(lt-At),bt=At-dt,lt=n*Ot,ht=lt-(lt-Ot),pt=Ot-ht,Tt=bt*pt-(mt-dt*ht-bt*ht-dt*pt),Mt=jt-Tt,at=jt-Mt,r[0]=jt-(Mt+at)+(at-Tt),yt=gt+Mt,at=yt-gt,xt=gt-(yt-at)+(Mt-at),Mt=xt-mt,at=xt-Mt,r[1]=xt-(Mt+at)+(at-mt),_t=yt+Mt,at=_t-yt,r[2]=yt-(_t-at)+(Mt-at),r[3]=_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_[0]=0,it=1),0!==S){const t=f(et,j,S,P);N=E(N,e(f(tt,x,S,F),F,f(t,P,2*At,k),k,z),z);const n=f(it,_,S,A);N=E(N,o(f(n,A,2*At,F),F,f(n,A,S,O),O,f(t,P,S,k),k,q,B),B),0!==U&&(N=E(N,f(f(4,a,S,A),A,U,F),F)),0!==V&&(N=E(N,f(f(4,u,-S,A),A,V,F),F))}if(0!==W){const t=f(et,j,W,P);N=E(N,e(f(nt,g,W,F),F,f(t,P,2*Pt,k),k,z),z);const n=f(it,_,W,A);N=E(N,o(f(n,A,2*Pt,F),F,f(n,A,W,O),O,f(t,P,W,k),k,q,B),B)}}return C[N-1]}(t,i,D,G,H,I,J,K,ft)},t.incirclefast=function(t,n,e,o,f,i,r,c){const s=t-r,u=n-c,a=e-r,l=o-c,d=f-r,b=i-c;return(s*s+u*u)*(a*b-d*l)+(a*a+l*l)*(d*u-s*b)+(d*d+b*b)*(s*l-a*u)},Object.defineProperty(t,"__esModule",{value:!0})}));