@inovitas/infra3dapi 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/12.infra3dapi.js +1 -1
- package/80.infra3dapi.js +1 -1
- package/README.md +55 -31
- package/infra3dapi.d.ts +153 -152
- package/infra3dapi.js +1 -1
- package/licenses.txt +110 -95
- package/package.json +1 -1
package/12.infra3dapi.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("infra3dapi",[],e):"object"==typeof exports?exports.infra3dapi=e():t.infra3dapi=e()}(self,(()=>(()=>{"use strict";var t,e,r={7012:(t,e,r)=>{var a=r(17505),o=r.n(a);const h=self;class s{constructor(){this.offsetConstant=6,this.minimumPixelDistance=5,this.NCCCutoff=.75,this.alphaCutoff=1e-6,this.minAffParsNorm=.15,this.minRadParsNorm=1.5,this.omegaIterationStop=1.01,this.mue=.1,this.alphaMin=1e-9,this.autoradio=1,this.searchWindowPosQuality=0,this.onprogress=null,this._createFilterMatrix=function(){let t=[],e=[];t.push([-3,0,3],[-10,0,10],[-3,0,3]),e.push([-3,-10,-3],[0,0,0],[3,10,3]);let r={};return r.filterX=t,r.filterY=e,r},this._obtainGradient=function(t,e){let r=[],a=[];for(let o=0;o<t.length;++o){let h=Math.floor(o/e),s=Math.floor(o%e);if(0!=s&&s!=e-1&&0!=h&&h!=e-1){let h=(t[o+1]-t[o-1])/2;r.push(h);let s=(t[o+e]-t[o-e])/2;a.push(s)}}let o={};return o.gradientX=r,o.gradientY=a,o},this._interpolate2D=function(t,e,r,a){if("bilinear"==a){let a=t[Math.floor(e[1])][Math.floor(e[0])],o=t[Math.floor(e[1])][Math.floor(e[0])+1],h=t[Math.floor(e[1])+1][Math.floor(e[0])],s=t[Math.floor(e[1])+1][Math.floor(e[0])+1];return a=r[0]*a+r[1],o=r[0]*o+r[1],h=r[0]*h+r[1],s=r[0]*s+r[1],(e[0]-Math.floor(e[0]))*(e[1]-Math.floor(e[1]))*s+(1-e[0]+Math.floor(e[0]))*(e[1]-Math.floor(e[1]))*h+(e[0]-Math.floor(e[0]))*(1-e[1]+Math.floor(e[1]))*o+(1-e[0]+Math.floor(e[0]))*(1-e[1]+Math.floor(e[1]))*a}if("lanczos2"==a){(p=[]).push(Math.floor(e[0])-1),p.push(p[0]+1),p.push(p[0]+2),p.push(p[0]+3),(d=[]).push(Math.floor(e[1])-1),d.push(d[0]+1),d.push(d[0]+2),d.push(d[0]+3);for(var o=[],h=0;h<4;++h)if((M=Math.abs(e[0]-p[h]))>=2)o.push(0);else if(0==M)o.push(1);else{if(!(M<2&&M>=0))return 0;var s=Math.sin(Math.PI*M)/(Math.PI*M)*Math.sin(Math.PI*M/2)/(Math.PI*M/2);o.push(s)}for(var i=[],n=0;n<4;++n){var l=0;for(h=0;h<4;++h)l+=o[h]*(r[0]*t[d[n]][p[h]]+r[1]);i.push(l)}var f=[];for(h=0;h<4;++h)if((M=Math.abs(e[1]-d[h]))>=2)f.push(0);else if(0==M)f.push(1);else{if(!(M<2&&M>=0))return 0;s=Math.sin(Math.PI*M)/(Math.PI*M)*Math.sin(Math.PI*M/2)/(Math.PI*M/2),f.push(s)}var u=0;for(n=0;n<4;++n)u+=f[n]*i[n];return u}if("lanczos3"==a){var p,d;for((p=[]).push(Math.floor(e[0])-2),p.push(p[0]+1),p.push(p[0]+2),p.push(p[0]+3),p.push(p[0]+4),p.push(p[0]+5),(d=[]).push(Math.floor(e[1])-2),d.push(d[0]+1),d.push(d[0]+2),d.push(d[0]+3),d.push(d[0]+4),d.push(d[0]+5),o=[],h=0;h<6;++h)if((M=Math.abs(e[0]-p[h]))>=2)o.push(0);else if(0==M)o.push(1);else{if(!(M<2&&M>=0))return 0;s=Math.sin(Math.PI*M)/(Math.PI*M)*Math.sin(Math.PI*M/3)/(Math.PI*M/3),o.push(s)}for(i=[],n=0;n<6;++n){for(l=0,h=0;h<6;++h)l+=o[h]*(r[0]*t[d[n]][p[h]]+r[1]);i.push(l)}for(f=[],h=0;h<6;++h){var M;if((M=Math.abs(e[1]-d[h]))>=2)f.push(0);else if(0==M)f.push(1);else{if(!(M<2&&M>=0))return 0;s=Math.sin(Math.PI*M)/(Math.PI*M)*Math.sin(Math.PI*M/3)/(Math.PI*M/3),f.push(s)}}for(u=0,n=0;n<6;++n)u+=f[n]*i[n];return u}},this._fillAMatrix=function(t,e,r,a,o){let h=[],s=0;for(let o=-Math.floor(a/2);o<=Math.floor(a/2);++o)for(let i=-Math.floor(a/2);i<=Math.floor(a/2);++i){let a=[i,0],n=[o,0],l=[0,i],f=[0,o],u=[1,0],p=[0,1],d=e[s]*a[0]+r[s]*a[1],M=e[s]*n[0]+r[s]*n[1],c=e[s]*l[0]+r[s]*l[1],g=e[s]*f[0]+r[s]*f[1],m=e[s]*u[0]+r[s]*u[1],v=e[s]*p[0]+r[s]*p[1];h.push([]);let C=t[s],N=1;h[s].push(d,M,c,g,m,v,C,N),s++}return h},this._Adjustment=function(t,e,r,a){let h=0,s=0,i=0,n=0,l=[Math.floor(t.length/2),Math.floor(t[0].length/2)],f=[a[0],a[1]],u=[1,0,0,1,l[1],l[0],1,0],p=[1,0,0,1,f[1],f[0],1,0],d=this._generatePatch(t,u,r),M=this._Wallisfilter(d);if(0==M)return 0;let c=p,g=c,m=1e10,v=0,C=0,N=0,P=[],_=[],b=[],w=o().diag([1,1,1,1,1,1,1,1]);for(;0==h;){this.onprogress&&this.onprogress();let t=this._generatePatch(e,c,r+2);if(0==t)return 0;let a=this._obtainGradient(t,r+2),l=a.gradientX,f=a.gradientY,u=this._generatePatch(e,c,r),d=this._Wallisfilter(u);if(0==d)return 0;0==s&&0==s&&(m=o().sub(M,d),N=this._NormCrossCor(M,d)),P=this._fillAMatrix(d,l,f,r,i),_=o().dot(o().transpose(P),P),0==i?(w[6][6]=1e32,w[7][7]=1e32):(w[6][6]=1,w[7][7]=1),_=o().add(_,w),b=o().dot(o().transpose(P),m);let O=o().solve(_,b),R=o().dot(P,O),k=o().dot(R,m),W=o().sub(R,m);v=C,C=.5*o().dot(W,W);let U=this._Linesearch(c,O,m,k,this.alphaMin,this.mue,M,d,e,r);if(0==U)return 0;var I=U.alphaLength;let T=U.xNew,z=U.rNew;N=U.NCC;var S=U.searchUpdate;g=c,c=T,m=z,o().norm2(R),o().norm2(m);let B=Math.sqrt(C/(Math.pow(r,2)-8)),Q=o().inv(_);for(var x=[],y=0;y<8;++y)x.push(Math.sqrt(B*Q[y][y]));let X=[],Y=[];for(y=0;y<8;++y){X.push([]);let t=Q[y][y];for(var D=0;D<8;++D){let e=Q[D][D];X[y].push(Q[y][D]/Math.sqrt(t*e))}}let $=7;for(y=0;y<7;++y){for(D=1;D<$;++D)X[y][D]>.99&&y!=D?X[y][D]>X[D][y]?Y.push(y,D,1e20,X[y][D]):Y.push(D,y,1e20,X[D][y]):X[y][D]>.9&&y!=D?X[y][D]>X[D][y]?Y.push(y,D,10/X[y][D],X[y][D]):Y.push(D,y,10/X[D][y],X[D][y]):X[y][D]>.7&&y!=D?X[y][D]>X[D][y]?Y.push(y,D,5/X[y][D],X[y][D]):Y.push(D,y,5/X[D][y],X[D][y]):X[y][D]>.5&&y!=D?X[y][D]>X[D][y]?Y.push(y,D,2/X[y][D],X[y][D]):Y.push(D,y,2/X[D][y],X[D][y]):X[y][D]>.3&&y!=D&&(X[y][D]>X[D][y]?Y.push(y,D,1/X[y][D],X[y][D]):Y.push(D,y,1/X[D][y],X[D][y]));--$}if(s++,(s>=50||I<this.alphaMin)&&(h=2),s>0&&v/C<this.omegaIterationStop&&v/C>1/this.omegaIterationStop)if(1==this.autoradio){if(0==i&&(n=s),i=1,v/C<this.omegaIterationStop&&v/C>1/this.omegaIterationStop&&s>n){let t=[];for(y=0;y<8;++y){let e=o().sub(c,p);t.push(Math.abs(e[y]/x[y]))}var A=o().getBlock(x,[0,0],[5,0]),j=o().getBlock(x,[6,0],[7,0]),L=o().norm2(A),q=o().norm2(j);h=L>this.minAffParsNorm||q>this.minRadParsNorm?2:1}}else v/C<this.omegaIterationStop&&v/C>1/this.omegaIterationStop&&(h=1)}if(0==h||2==h)return 0;if(1==h){let t={};return t.alphaLength=I,t.x=c,t.r=m,t.NCC=N,t.searchUpdate=S,t.ParsStdDev=x,t.AffStdDev=A,t.RadStdDev=j,t.NormAffStdDev=L,t.NormRadStdDev=q,t}},this._Linesearch=function(t,e,r,a,h,s,i,n,l,f){let u=.5*o().dot(r,r),p=1;for(;Math.abs(p)>=this.alphaMin;){let r=o().add(t,o().dot(p,e)),h=this._generatePatch(l,r,f);var d=this._Wallisfilter(h);if(0==d)return 0;let s=o().sub(i,d);var M=this._NormCrossCor(i,d);if(.5*o().dot(s,s)<.1+u+this.mue*p*a)return(c={}).alphaLength=p,c.Change=o().dot(p,e),c.xNew=r,c.rNew=s,c.NCC=M,c.searchUpdate=d,c;p/=2}var c;return(c={alphaLength:0}).xNew=o().add(t,e),c.rNew=r,c.NCC=M,c.searchUpdate=d,c},this._NormCrossCor=function(t,e){let r=t.length,a=(Math.sqrt(r),0),o=0,h=0,s=0;for(var i=0;i<r;++i)a+=t[i],o+=e[i];for(a/=r,o/=r,i=0;i<r;++i)h+=Math.pow(t[i]-a,2),s+=Math.pow(e[i]-o,2);h=Math.sqrt(h/r),s=Math.sqrt(s/r);let n=0;for(i=0;i<r;++i)n+=(t[i]-a)*(e[i]-o)/(h*s);return n*=1/r,n}}runLsm(t,e){let r=(this._IntegralImage(t),this._IntegralImage(e),[Math.floor(t.length/2),Math.floor(t[0].length/2)]),a=[1,0,0,1,r[1],r[0],1,0],o=this._generatePatch(t,a,15),h=this._Wallisfilter(o),s=[],i=[];for(var n=this.offsetConstant;n<e[0].length-(15+this.offsetConstant);++n){i=[Math.floor(e.length/2),n+Math.floor(7.5)],a=[1,0,0,1,i[1],i[0],1,0];let t=this._generatePatch(e,a,15),r=this._Wallisfilter(t);s.push(this._NormCrossCor(h,r))}let l=[],f=0,u=0,p=-1,d=this.offsetConstant+Math.floor(7.5);for(n=0;n<s.length;++n)s[n]>this.NCCCutoff&&s[n]>f?(f=s[n],p=n+d,u=this.minimumPixelDistance):u>0&&(--u,0==u&&(l.push(i[0],p),p=-1,f=0));let M=[];for(n=0;n<l.length;n+=2){a=[l[n],l[n+1]];let r=this._Adjustment(t,e,15,a);if(0!=r){var c={};c.alphaLength=r.alphaLength,c.x=r.x,c.r=r.r,c.NCC=r.NCC,c.searchUpdate=r.searchUpdate,c.ParsStdDev=r.ParsStdDev,c.NormAffStdDev=r.NormAffStdDev,c.NormRadStdDev=r.NormRadStdDev,M.push(c)}}let g=this.NCCCutoff,m=-1,v=this.minAffParsNorm,C=this.minRadParsNorm,N=e[0].length/2,P=1/0;for(n=0;n<M.length;++n)if(this.searchWindowPosQuality>.7){var _=Math.abs(N-M[n].x[4]);_<P&&(m=n,P=_)}else M[n].NCC>g&&M[n].alphaLength>this.alphaCutoff&&M[n].NormAffStdDev<v&&M[n].NormRadStdDev<C&&(m=n,g=M[n].NCC,v=M[n].NormAffStdDev,C=M[n].NormRadStdDev,P=_);return m>-1?[M[m].x[4],M[m].x[5]]:(M.push(c),null)}_Wallisfilter(t){let e=[],r=0,a=0;for(var o=0;o<t.length;++o)r+=t[o];for(r/=t.length,o=0;o<t.length;++o)a+=Math.pow(t[o]-r,2);a=Math.sqrt(a/t.length);let h=81/(.9*a+90*(1-.9)),s=127.5+(0-h)*r;for(let r=0;r<t.length;++r){let a=t[r]*h+s;e[r]=a>255?255:a<0?0:a}return e}_IntegralImage(t){let e=[],r=[];for(let a=0;a<t.length;++a){e.push([]),r.push([]);for(let o=0;o<t[0].length;++o){let h=0,s=0,i=0;o>0&&(h=e[a][o-1]),a>0&&(s=e[a-1][o]),o>0&&a>0&&(i=e[a-1][o-1]);let n=t[a][o]+h+s-i;e[a].push(n),r[a].push(Math.pow(n,2))}}let a={};return a.Integral=e,a.IntegralSq=r,a}_generatePatch(t,e,r){let a=[],h=[[e[0],e[1]],[e[2],e[3]]],s=[[e[4]],[e[5]]],i=[e[6],e[7]],n=0;for(let e=-Math.floor(r/2);e<=Math.floor(r/2)&&1!=n;++e)for(let l=-Math.floor(r/2);l<=Math.floor(r/2);++l){let r=[[l],[e]],f=o().add(o().dot(h,r),s);if(f[1]<this.offsetConstant||f[1]>t.length-this.offsetConstant||f[0]<this.offsetConstant||f[0]>t[0].length-this.offsetConstant){n=1;break}let u=this._interpolate2D(t,f,i,"lanczos2");a.push(u)}return 0==n?a:0}}h.onmessage=t=>{if(t.data.topic&&"run"===t.data.topic){var e=new s;t.data.searchwindowposquality&&(e.searchWindowPosQuality=t.data.searchwindowposquality),t.data.NCC_Threshold&&(e.NCCCutoff=t.data.NCC_Threshold),t.data.adjustRadiometry&&(e.autoradio=1);var r=e.runLsm(t.data.template,t.data.searchwindow);h.postMessage(r)}}}},a={};function o(t){var e=a[t];if(void 0!==e)return e.exports;var h=a[t]={exports:{}};return r[t](h,h.exports,o),h.exports}return o.m=r,o.x=()=>{var t=o.O(void 0,[505],(()=>o(7012)));return o.O(t)},t=[],o.O=(e,r,a,h)=>{if(!r){var s=1/0;for(f=0;f<t.length;f++){r=t[f][0],a=t[f][1],h=t[f][2];for(var i=!0,n=0;n<r.length;n++)(!1&h||s>=h)&&Object.keys(o.O).every((t=>o.O[t](r[n])))?r.splice(n--,1):(i=!1,h<s&&(s=h));if(i){t.splice(f--,1);var l=a();void 0!==l&&(e=l)}}return e}h=h||0;for(var f=t.length;f>0&&t[f-1][2]>h;f--)t[f]=t[f-1];t[f]=[r,a,h]},o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.f={},o.e=t=>Promise.all(Object.keys(o.f).reduce(((e,r)=>(o.f[r](t,e),e)),[])),o.u=t=>t+".infra3dapi.js",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t;o.g.importScripts&&(t=o.g.location+"");var e=o.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var r=e.getElementsByTagName("script");if(r.length)for(var a=r.length-1;a>-1&&(!t||!/^http(s?):/.test(t));)t=r[a--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=t})(),(()=>{var t={12:1};o.f.i=(e,r)=>{t[e]||importScripts(o.p+o.u(e))};var e=self.webpackChunkinfra3dapi=self.webpackChunkinfra3dapi||[],r=e.push.bind(e);e.push=e=>{var a=e[0],h=e[1],s=e[2];for(var i in h)o.o(h,i)&&(o.m[i]=h[i]);for(s&&s(o);a.length;)t[a.pop()]=1;r(e)}})(),e=o.x,o.x=()=>o.e(505).then(e),o.x()})()));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("infra3dapi",[],e):"object"==typeof exports?exports.infra3dapi=e():t.infra3dapi=e()}(self,(()=>(()=>{"use strict";var t,e,r={7012:(t,e,r)=>{var a=r(17505),o=r.n(a);const h=self;class s{constructor(){this.offsetConstant=6,this.minimumPixelDistance=5,this.NCCCutoff=.75,this.alphaCutoff=1e-6,this.minAffParsNorm=.15,this.minRadParsNorm=1.5,this.omegaIterationStop=1.01,this.mue=.1,this.alphaMin=1e-9,this.autoradio=1,this.searchWindowPosQuality=0,this.onprogress=null,this._createFilterMatrix=function(){let t=[],e=[];t.push([-3,0,3],[-10,0,10],[-3,0,3]),e.push([-3,-10,-3],[0,0,0],[3,10,3]);let r={};return r.filterX=t,r.filterY=e,r},this._obtainGradient=function(t,e){let r=[],a=[];for(let o=0;o<t.length;++o){let h=Math.floor(o/e),s=Math.floor(o%e);if(0!=s&&s!=e-1&&0!=h&&h!=e-1){let h=(t[o+1]-t[o-1])/2;r.push(h);let s=(t[o+e]-t[o-e])/2;a.push(s)}}let o={};return o.gradientX=r,o.gradientY=a,o},this._interpolate2D=function(t,e,r,a){if("bilinear"==a){let a=t[Math.floor(e[1])][Math.floor(e[0])],o=t[Math.floor(e[1])][Math.floor(e[0])+1],h=t[Math.floor(e[1])+1][Math.floor(e[0])],s=t[Math.floor(e[1])+1][Math.floor(e[0])+1];return a=r[0]*a+r[1],o=r[0]*o+r[1],h=r[0]*h+r[1],s=r[0]*s+r[1],(e[0]-Math.floor(e[0]))*(e[1]-Math.floor(e[1]))*s+(1-e[0]+Math.floor(e[0]))*(e[1]-Math.floor(e[1]))*h+(e[0]-Math.floor(e[0]))*(1-e[1]+Math.floor(e[1]))*o+(1-e[0]+Math.floor(e[0]))*(1-e[1]+Math.floor(e[1]))*a}if("lanczos2"==a){(p=[]).push(Math.floor(e[0])-1),p.push(p[0]+1),p.push(p[0]+2),p.push(p[0]+3),(d=[]).push(Math.floor(e[1])-1),d.push(d[0]+1),d.push(d[0]+2),d.push(d[0]+3);for(var o=[],h=0;h<4;++h)if((M=Math.abs(e[0]-p[h]))>=2)o.push(0);else if(0==M)o.push(1);else{if(!(M<2&&M>=0))return 0;var s=Math.sin(Math.PI*M)/(Math.PI*M)*Math.sin(Math.PI*M/2)/(Math.PI*M/2);o.push(s)}for(var i=[],n=0;n<4;++n){var l=0;for(h=0;h<4;++h)l+=o[h]*(r[0]*t[d[n]][p[h]]+r[1]);i.push(l)}var f=[];for(h=0;h<4;++h)if((M=Math.abs(e[1]-d[h]))>=2)f.push(0);else if(0==M)f.push(1);else{if(!(M<2&&M>=0))return 0;s=Math.sin(Math.PI*M)/(Math.PI*M)*Math.sin(Math.PI*M/2)/(Math.PI*M/2),f.push(s)}var u=0;for(n=0;n<4;++n)u+=f[n]*i[n];return u}if("lanczos3"==a){var p,d;for((p=[]).push(Math.floor(e[0])-2),p.push(p[0]+1),p.push(p[0]+2),p.push(p[0]+3),p.push(p[0]+4),p.push(p[0]+5),(d=[]).push(Math.floor(e[1])-2),d.push(d[0]+1),d.push(d[0]+2),d.push(d[0]+3),d.push(d[0]+4),d.push(d[0]+5),o=[],h=0;h<6;++h)if((M=Math.abs(e[0]-p[h]))>=2)o.push(0);else if(0==M)o.push(1);else{if(!(M<2&&M>=0))return 0;s=Math.sin(Math.PI*M)/(Math.PI*M)*Math.sin(Math.PI*M/3)/(Math.PI*M/3),o.push(s)}for(i=[],n=0;n<6;++n){for(l=0,h=0;h<6;++h)l+=o[h]*(r[0]*t[d[n]][p[h]]+r[1]);i.push(l)}for(f=[],h=0;h<6;++h){var M;if((M=Math.abs(e[1]-d[h]))>=2)f.push(0);else if(0==M)f.push(1);else{if(!(M<2&&M>=0))return 0;s=Math.sin(Math.PI*M)/(Math.PI*M)*Math.sin(Math.PI*M/3)/(Math.PI*M/3),f.push(s)}}for(u=0,n=0;n<6;++n)u+=f[n]*i[n];return u}},this._fillAMatrix=function(t,e,r,a,o){let h=[],s=0;for(let o=-Math.floor(a/2);o<=Math.floor(a/2);++o)for(let i=-Math.floor(a/2);i<=Math.floor(a/2);++i){let a=[i,0],n=[o,0],l=[0,i],f=[0,o],u=[1,0],p=[0,1],d=e[s]*a[0]+r[s]*a[1],M=e[s]*n[0]+r[s]*n[1],g=e[s]*l[0]+r[s]*l[1],c=e[s]*f[0]+r[s]*f[1],m=e[s]*u[0]+r[s]*u[1],v=e[s]*p[0]+r[s]*p[1];h.push([]);let C=t[s],N=1;h[s].push(d,M,g,c,m,v,C,N),s++}return h},this._Adjustment=function(t,e,r,a){let h=0,s=0,i=0,n=0,l=[Math.floor(t.length/2),Math.floor(t[0].length/2)],f=[a[0],a[1]],u=[1,0,0,1,l[1],l[0],1,0],p=[1,0,0,1,f[1],f[0],1,0],d=this._generatePatch(t,u,r),M=this._Wallisfilter(d);if(0==M)return 0;let g=p,c=g,m=1e10,v=0,C=0,N=0,P=[],_=[],I=[],b=o().diag([1,1,1,1,1,1,1,1]);for(;0==h;){this.onprogress&&this.onprogress();let t=this._generatePatch(e,g,r+2);if(0==t)return 0;let a=this._obtainGradient(t,r+2),l=a.gradientX,f=a.gradientY,u=this._generatePatch(e,g,r),d=this._Wallisfilter(u);if(0==d)return 0;0==s&&0==s&&(m=o().sub(M,d),N=this._NormCrossCor(M,d)),P=this._fillAMatrix(d,l,f,r,i),_=o().dot(o().transpose(P),P),0==i?(b[6][6]=1e32,b[7][7]=1e32):(b[6][6]=1,b[7][7]=1),_=o().add(_,b),I=o().dot(o().transpose(P),m);let O=o().solve(_,I),R=o().dot(P,O),k=o().dot(R,m),W=o().sub(R,m);v=C,C=.5*o().dot(W,W);let U=this._Linesearch(g,O,m,k,this.alphaMin,this.mue,M,d,e,r);if(0==U)return 0;var w=U.alphaLength;let T=U.xNew,z=U.rNew;N=U.NCC;var x=U.searchUpdate;c=g,g=T,m=z,o().norm2(R),o().norm2(m);let Q=Math.sqrt(C/(Math.pow(r,2)-8)),X=o().inv(_);for(var S=[],y=0;y<8;++y)S.push(Math.sqrt(Q*X[y][y]));let Y=[],B=[];for(y=0;y<8;++y){Y.push([]);let t=X[y][y];for(var D=0;D<8;++D){let e=X[D][D];Y[y].push(X[y][D]/Math.sqrt(t*e))}}let F=7;for(y=0;y<7;++y){for(D=1;D<F;++D)Y[y][D]>.99&&y!=D?Y[y][D]>Y[D][y]?B.push(y,D,1e20,Y[y][D]):B.push(D,y,1e20,Y[D][y]):Y[y][D]>.9&&y!=D?Y[y][D]>Y[D][y]?B.push(y,D,10/Y[y][D],Y[y][D]):B.push(D,y,10/Y[D][y],Y[D][y]):Y[y][D]>.7&&y!=D?Y[y][D]>Y[D][y]?B.push(y,D,5/Y[y][D],Y[y][D]):B.push(D,y,5/Y[D][y],Y[D][y]):Y[y][D]>.5&&y!=D?Y[y][D]>Y[D][y]?B.push(y,D,2/Y[y][D],Y[y][D]):B.push(D,y,2/Y[D][y],Y[D][y]):Y[y][D]>.3&&y!=D&&(Y[y][D]>Y[D][y]?B.push(y,D,1/Y[y][D],Y[y][D]):B.push(D,y,1/Y[D][y],Y[D][y]));--F}if(s++,(s>=50||w<this.alphaMin)&&(h=2),s>0&&v/C<this.omegaIterationStop&&v/C>1/this.omegaIterationStop)if(1==this.autoradio){if(0==i&&(n=s),i=1,v/C<this.omegaIterationStop&&v/C>1/this.omegaIterationStop&&s>n){let t=[];for(y=0;y<8;++y){let e=o().sub(g,p);t.push(Math.abs(e[y]/S[y]))}var j=o().getBlock(S,[0,0],[5,0]),A=o().getBlock(S,[6,0],[7,0]),L=o().norm2(j),q=o().norm2(A);h=L>this.minAffParsNorm||q>this.minRadParsNorm?2:1}}else v/C<this.omegaIterationStop&&v/C>1/this.omegaIterationStop&&(h=1)}if(0==h||2==h)return 0;if(1==h){let t={};return t.alphaLength=w,t.x=g,t.r=m,t.NCC=N,t.searchUpdate=x,t.ParsStdDev=S,t.AffStdDev=j,t.RadStdDev=A,t.NormAffStdDev=L,t.NormRadStdDev=q,t}},this._Linesearch=function(t,e,r,a,h,s,i,n,l,f){let u=.5*o().dot(r,r),p=1;for(;Math.abs(p)>=this.alphaMin;){let r=o().add(t,o().dot(p,e)),h=this._generatePatch(l,r,f);var d=this._Wallisfilter(h);if(0==d)return 0;let s=o().sub(i,d);var M=this._NormCrossCor(i,d);if(.5*o().dot(s,s)<.1+u+this.mue*p*a)return(g={}).alphaLength=p,g.Change=o().dot(p,e),g.xNew=r,g.rNew=s,g.NCC=M,g.searchUpdate=d,g;p/=2}var g;return(g={alphaLength:0}).xNew=o().add(t,e),g.rNew=r,g.NCC=M,g.searchUpdate=d,g},this._NormCrossCor=function(t,e){let r=t.length,a=(Math.sqrt(r),0),o=0,h=0,s=0;for(var i=0;i<r;++i)a+=t[i],o+=e[i];for(a/=r,o/=r,i=0;i<r;++i)h+=Math.pow(t[i]-a,2),s+=Math.pow(e[i]-o,2);h=Math.sqrt(h/r),s=Math.sqrt(s/r);let n=0;for(i=0;i<r;++i)n+=(t[i]-a)*(e[i]-o)/(h*s);return n*=1/r,n}}runLsm(t,e){let r=(this._IntegralImage(t),this._IntegralImage(e),[Math.floor(t.length/2),Math.floor(t[0].length/2)]),a=[1,0,0,1,r[1],r[0],1,0],o=this._generatePatch(t,a,15),h=this._Wallisfilter(o),s=[],i=[];for(var n=this.offsetConstant;n<e[0].length-(15+this.offsetConstant);++n){i=[Math.floor(e.length/2),n+Math.floor(7.5)],a=[1,0,0,1,i[1],i[0],1,0];let t=this._generatePatch(e,a,15),r=this._Wallisfilter(t);s.push(this._NormCrossCor(h,r))}let l=[],f=0,u=0,p=-1,d=this.offsetConstant+Math.floor(7.5);for(n=0;n<s.length;++n)s[n]>this.NCCCutoff&&s[n]>f?(f=s[n],p=n+d,u=this.minimumPixelDistance):u>0&&(--u,0==u&&(l.push(i[0],p),p=-1,f=0));let M=[];for(n=0;n<l.length;n+=2){a=[l[n],l[n+1]];let r=this._Adjustment(t,e,15,a);if(0!=r){var g={};g.alphaLength=r.alphaLength,g.x=r.x,g.r=r.r,g.NCC=r.NCC,g.searchUpdate=r.searchUpdate,g.ParsStdDev=r.ParsStdDev,g.NormAffStdDev=r.NormAffStdDev,g.NormRadStdDev=r.NormRadStdDev,M.push(g)}}let c=this.NCCCutoff,m=-1,v=this.minAffParsNorm,C=this.minRadParsNorm,N=e[0].length/2,P=1/0;for(n=0;n<M.length;++n)if(this.searchWindowPosQuality>.7){var _=Math.abs(N-M[n].x[4]);_<P&&(m=n,P=_)}else M[n].NCC>c&&M[n].alphaLength>this.alphaCutoff&&M[n].NormAffStdDev<v&&M[n].NormRadStdDev<C&&(m=n,c=M[n].NCC,v=M[n].NormAffStdDev,C=M[n].NormRadStdDev,P=_);return m>-1?[M[m].x[4],M[m].x[5]]:(M.push(g),null)}_Wallisfilter(t){let e=[],r=0,a=0;for(var o=0;o<t.length;++o)r+=t[o];for(r/=t.length,o=0;o<t.length;++o)a+=Math.pow(t[o]-r,2);a=Math.sqrt(a/t.length);let h=81/(.9*a+90*(1-.9)),s=127.5+(0-h)*r;for(let r=0;r<t.length;++r){let a=t[r]*h+s;e[r]=a>255?255:a<0?0:a}return e}_IntegralImage(t){let e=[],r=[];for(let a=0;a<t.length;++a){e.push([]),r.push([]);for(let o=0;o<t[0].length;++o){let h=0,s=0,i=0;o>0&&(h=e[a][o-1]),a>0&&(s=e[a-1][o]),o>0&&a>0&&(i=e[a-1][o-1]);let n=t[a][o]+h+s-i;e[a].push(n),r[a].push(Math.pow(n,2))}}let a={};return a.Integral=e,a.IntegralSq=r,a}_generatePatch(t,e,r){let a=[],h=[[e[0],e[1]],[e[2],e[3]]],s=[[e[4]],[e[5]]],i=[e[6],e[7]],n=0;for(let e=-Math.floor(r/2);e<=Math.floor(r/2)&&1!=n;++e)for(let l=-Math.floor(r/2);l<=Math.floor(r/2);++l){let r=[[l],[e]],f=o().add(o().dot(h,r),s);if(f[1]<this.offsetConstant||f[1]>t.length-this.offsetConstant||f[0]<this.offsetConstant||f[0]>t[0].length-this.offsetConstant){n=1;break}let u=this._interpolate2D(t,f,i,"lanczos2");a.push(u)}return 0==n?a:0}}h.onmessage=t=>{if(t.data.topic&&"run"===t.data.topic){var e=new s;t.data.searchwindowposquality&&(e.searchWindowPosQuality=t.data.searchwindowposquality),t.data.NCC_Threshold&&(e.NCCCutoff=t.data.NCC_Threshold),t.data.adjustRadiometry&&(e.autoradio=1);var r=e.runLsm(t.data.template,t.data.searchwindow);h.postMessage(r)}}}},a={};function o(t){var e=a[t];if(void 0!==e)return e.exports;var h=a[t]={exports:{}};return r[t](h,h.exports,o),h.exports}return o.m=r,o.x=()=>{var t=o.O(void 0,[505],(()=>o(7012)));return o.O(t)},t=[],o.O=(e,r,a,h)=>{if(!r){var s=1/0;for(f=0;f<t.length;f++){r=t[f][0],a=t[f][1],h=t[f][2];for(var i=!0,n=0;n<r.length;n++)(!1&h||s>=h)&&Object.keys(o.O).every((t=>o.O[t](r[n])))?r.splice(n--,1):(i=!1,h<s&&(s=h));if(i){t.splice(f--,1);var l=a();void 0!==l&&(e=l)}}return e}h=h||0;for(var f=t.length;f>0&&t[f-1][2]>h;f--)t[f]=t[f-1];t[f]=[r,a,h]},o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.f={},o.e=t=>Promise.all(Object.keys(o.f).reduce(((e,r)=>(o.f[r](t,e),e)),[])),o.u=t=>t+".infra3dapi.js",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.p="",(()=>{var t={12:1};o.f.i=(e,r)=>{t[e]||importScripts(o.p+o.u(e))};var e=self.webpackChunkinfra3dapi=self.webpackChunkinfra3dapi||[],r=e.push.bind(e);e.push=e=>{var a=e[0],h=e[1],s=e[2];for(var i in h)o.o(h,i)&&(o.m[i]=h[i]);for(s&&s(o);a.length;)t[a.pop()]=1;r(e)}})(),e=o.x,o.x=()=>o.e(505).then(e),o.x()})()));
|
package/80.infra3dapi.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,a){"object"==typeof exports&&"object"==typeof module?module.exports=a():"function"==typeof define&&define.amd?define("infra3dapi",[],a):"object"==typeof exports?exports.infra3dapi=a():t.infra3dapi=a()}(self,(()=>(()=>{"use strict";var t,a,s={35080:(t,a,s)=>{var o=s(17505),
|
|
1
|
+
!function(t,a){"object"==typeof exports&&"object"==typeof module?module.exports=a():"function"==typeof define&&define.amd?define("infra3dapi",[],a):"object"==typeof exports?exports.infra3dapi=a():t.infra3dapi=a()}(self,(()=>(()=>{"use strict";var t,a,s={35080:(t,a,s)=>{var o=s(17505),i=s.n(o);const e=self;class h{constructor(){this.data=[],this.approxval=null,this.thresh=1e-9,this.iterLimit=100,this.finalIterations=-1,this.convergence=!1,this.correction=[0,0,0],this.onprogress=null}calcApproxValue(){let t,a,s,o,e,h;const r=[],n=[];for(let p=0;p<this.data.length;p++){if(a=this.data[p],t=[a[0],a[1],a[2]],s=this.getRotMat(a[3]*Math.PI/180,a[4]*Math.PI/180,a[5]*Math.PI/180),o=[.001*a[6],.001*a[7],.001*-a[8]],e=i().add(t,i().dot(s,o)),1==a[10]){const o=.001*a[6]/(.001*-a[8]),h=.001*a[7]/(.001*-a[8]),r=Math.sqrt(o*o+h*h),n=o/r*Math.sin(r),p=h/r*Math.sin(r),c=Math.cos(r),d=i().mul(.001*-a[8],[n,p,c]);e=i().add(t,i().dot(s,d))}r.push(e),h=i().sub(e,t),n.push(h)}let p=0,c=[-1,-1];for(let t=0;t<n.length;t++)for(let a=0;a<n.length;a++){if(t==a)continue;const s=Math.acos(i().dot(n[t],n[a])/(i().norm2(n[t])*i().norm2(n[a])));s>p&&(c=[t,a],p=s)}const d=[this.data[c[0]][0],this.data[c[0]][1],this.data[c[0]][2]],l=[this.data[c[1]][0],this.data[c[1]][1],this.data[c[1]][2]],M=r[c[0]],u=r[c[1]],f=d[0],v=d[1],g=d[2],w=l[0],x=l[1],b=l[2];let m=i().norm2(i().sub(M,d));const y=(M[0]-d[0])/m,q=(M[1]-d[1])/m,P=(M[2]-d[2])/m;m=i().norm2(i().sub(u,l));const I=(u[0]-l[0])/m,O=(u[1]-l[1])/m,j=(u[2]-l[2])/m,k=i().det([[y,q],[I,O]]),L=i().det([[q,P],[O,j]]),_=i().det([[P,y],[j,I]]),z=i().det([[y,q,P],[I,O,j],[k,L,_]]),D=i().det([[f-w,v-x,g-b],[k,L,_],[I,O,j]])/z,E=i().det([[f-w,v-x,g-b],[k,L,_],[y,q,P]])/z,R=(f+D*y+(w+E*I))/2,A=(v+D*q+(x+E*O))/2,B=(g+D*P+(b+E*j))/2;return Math.acos(y*I+q*O+P*j),[R,A,B]}runBuendel(t){this.data=JSON.parse(t),null==this.approxval&&(this.approxval=this.calcApproxValue()),this.approxval=[this.approxval[0]-this.data[0][0],this.approxval[1]-this.data[0][1],this.approxval[2]-this.data[0][2]];let a=[0,0,0],s=[],o=[],e=[],h=this.approxval;for(var r=0;r<this.iterLimit;r++){s=[],o=[],e=[],h=i().add(h,[a[0],a[1],a[2]]);for(let t=0;t<this.data.length;t++){const a=[this.data[t][0]-this.data[0][0],this.data[t][1]-this.data[0][1],this.data[t][2]-this.data[0][2]],i=this.getRotMat(this.data[t][3]*Math.PI/180,this.data[t][4]*Math.PI/180,this.data[t][5]*Math.PI/180);let r,n;r=0==this.data[t][10]||2==this.data[t][10]||3==this.data[t][10]?this.coLinEquation(i,a,h,this.data[t][8]):this.coLinEquationPano(i,a,h,this.data[t][8]),e.push(this.data[t][6]-r[0]),e.push(this.data[t][7]-r[1]),n=0==this.data[t][10]||2==this.data[t][10]||3==this.data[t][10]?this.getDeriatives(i,a,h,this.data[t][8]):this.getDeriativesPano(i,a,h,this.data[t][8]),s.push([n[0],n[1],n[2]]),s.push([n[3],n[4],n[5]]),o.push(this.data[t][9]),o.push(this.data[t][9])}const t=i().diag(o),r=i().dot(i().transpose(s),t),p=i().dot(r,s);var n=i().inv(p);a=i().dot(i().dot(n,r),e);const c=i().norm2(a),d={topic:"correction_update",value:c};if(null!==this.onprogress&&this.onprogress(d),c<this.thresh)break}if(r>=this.iterLimit)return this.convergence=!1,null;const p=i().sub(i().dot(s,a),e),c=Math.sqrt(i().dot(p,p)/(2*this.data.length-a.length)),d=[c*Math.sqrt(n[0][0]),c*Math.sqrt(n[1][1]),c*Math.sqrt(n[2][2])];return this.convergence=!0,this.finalIterations=r,this.correction=h,this.m0=c,this.s_xyz=d,this.residuals=p,[h[0]+this.data[0][0],h[1]+this.data[0][1],h[2]+this.data[0][2]]}getRotMat(t,a,s){return[[Math.cos(a)*Math.cos(s),-Math.cos(a)*Math.sin(s),Math.sin(a)],[Math.cos(t)*Math.sin(s)+Math.sin(t)*Math.sin(a)*Math.cos(s),Math.cos(t)*Math.cos(s)-Math.sin(t)*Math.sin(a)*Math.sin(s),-Math.sin(t)*Math.cos(a)],[Math.sin(t)*Math.sin(s)-Math.cos(t)*Math.sin(a)*Math.cos(s),Math.sin(t)*Math.cos(s)+Math.cos(t)*Math.sin(a)*Math.sin(s),Math.cos(t)*Math.cos(a)]]}getDeriatives(t,a,s,o){const i=-o,e=t[0][0]*(s[0]-a[0])+t[1][0]*(s[1]-a[1])+t[2][0]*(s[2]-a[2]),h=t[0][1]*(s[0]-a[0])+t[1][1]*(s[1]-a[1])+t[2][1]*(s[2]-a[2]),r=t[0][2]*(s[0]-a[0])+t[1][2]*(s[1]-a[1])+t[2][2]*(s[2]-a[2]);return[-i/Math.pow(r,2)*(t[0][2]*e-t[0][0]*r),-i/Math.pow(r,2)*(t[1][2]*e-t[1][0]*r),-i/Math.pow(r,2)*(t[2][2]*e-t[2][0]*r),-i/Math.pow(r,2)*(t[0][2]*h-t[0][1]*r),-i/Math.pow(r,2)*(t[1][2]*h-t[1][1]*r),-i/Math.pow(r,2)*(t[2][2]*h-t[2][1]*r)]}getDeriativesPano(t,a,s,o){const i=t[0][0]*(s[0]-a[0])+t[1][0]*(s[1]-a[1])+t[2][0]*(s[2]-a[2]),e=t[0][1]*(s[0]-a[0])+t[1][1]*(s[1]-a[1])+t[2][1]*(s[2]-a[2]),h=t[0][2]*(s[0]-a[0])+t[1][2]*(s[1]-a[1])+t[2][2]*(s[2]-a[2]);Math.pow(h,2),t[0][2],t[0][0],Math.pow(h,2),t[1][2],t[1][0],Math.pow(h,2),t[2][2],t[2][0],Math.pow(h,2),t[0][2],t[0][1],Math.pow(h,2),t[1][2],t[1][1],Math.pow(h,2),t[2][2],t[2][1];let r=t[0][0],n=t[0][1],p=t[0][2],c=i,d=e,l=h,M=h*h,u=o,f=Math.pow(c,2)+Math.pow(d,2),v=Math.sqrt(f),g=Math.atan(Math.sqrt(f)/l),w=c*r+d*n;const x=-u*g*r/v-u*(-v*p/M+w/(v*l))*c/(v*(f/M+1))+u*g*w*c/Math.pow(f,1.5),b=-u*g*n/v-u*(-v*p/M+w/(v*l))*d/(v*(f/M+1))+u*g*w*d/Math.pow(f,1.5);r=t[1][0],n=t[1][1],p=t[1][2],c=i,d=e,l=h,M=h*h,u=o,f=Math.pow(c,2)+Math.pow(d,2),v=Math.sqrt(f),g=Math.atan(Math.sqrt(f)/l),w=c*r+d*n;const m=-u*g*r/v-u*(-v*p/M+w/(v*l))*c/(v*(f/M+1))+u*g*w*c/Math.pow(f,1.5),y=-u*g*n/v-u*(-v*p/M+w/(v*l))*d/(v*(f/M+1))+u*g*w*d/Math.pow(f,1.5);return r=t[2][0],n=t[2][1],p=t[2][2],c=i,d=e,l=h,M=h*h,u=o,f=Math.pow(c,2)+Math.pow(d,2),v=Math.sqrt(f),g=Math.atan(Math.sqrt(f)/l),w=c*r+d*n,[x,m,-u*g*r/v-u*(-v*p/M+w/(v*l))*c/(v*(f/M+1))+u*g*w*c/Math.pow(f,1.5),b,y,-u*g*n/v-u*(-v*p/M+w/(v*l))*d/(v*(f/M+1))+u*g*w*d/Math.pow(f,1.5)]}coLinEquation(t,a,s,o){const i=t[0][0]*(s[0]-a[0])+t[1][0]*(s[1]-a[1])+t[2][0]*(s[2]-a[2]),e=t[0][1]*(s[0]-a[0])+t[1][1]*(s[1]-a[1])+t[2][1]*(s[2]-a[2]),h=t[0][2]*(s[0]-a[0])+t[1][2]*(s[1]-a[1])+t[2][2]*(s[2]-a[2]);return[-o*i/h,-o*e/h]}coLinEquationPano(t,a,s,o){const i=t[0][0]*(s[0]-a[0])+t[1][0]*(s[1]-a[1])+t[2][0]*(s[2]-a[2]),e=t[0][1]*(s[0]-a[0])+t[1][1]*(s[1]-a[1])+t[2][1]*(s[2]-a[2]),h=t[0][2]*(s[0]-a[0])+t[1][2]*(s[1]-a[1])+t[2][2]*(s[2]-a[2]),r=Math.sqrt(i*i+e*e);return[-o*i/r*Math.atan(r/h),-o*e/r*Math.atan(r/h)]}}e.onmessage=t=>{if(t.data.topic&&"run"===t.data.topic){const a=new h;if(a.onprogress=t=>{e.postMessage(t)},t.data.approxval?a.approxval=t.data.approxval:a.approxval=null,t.data.observations){let s={};try{s={topic:"result",result:a.runBuendel(t.data.observations),convergence:a.convergence,finalIterations:a.finalIterations,correction:a.correction,m0:a.m0,s_xyz:a.s_xyz,residuals:a.residuals}}catch(t){console.log(t),s={topic:"result",result:[0,0,0],convergence:!1,finalIterations:-1,correction:[0,0,0],m0:1/0,s_xyz:[1/0,1/0,1/0],residuals:[]}}e.postMessage(s)}}}}},o={};function i(t){var a=o[t];if(void 0!==a)return a.exports;var e=o[t]={exports:{}};return s[t](e,e.exports,i),e.exports}return i.m=s,i.x=()=>{var t=i.O(void 0,[505],(()=>i(35080)));return i.O(t)},t=[],i.O=(a,s,o,e)=>{if(!s){var h=1/0;for(c=0;c<t.length;c++){s=t[c][0],o=t[c][1],e=t[c][2];for(var r=!0,n=0;n<s.length;n++)(!1&e||h>=e)&&Object.keys(i.O).every((t=>i.O[t](s[n])))?s.splice(n--,1):(r=!1,e<h&&(h=e));if(r){t.splice(c--,1);var p=o();void 0!==p&&(a=p)}}return a}e=e||0;for(var c=t.length;c>0&&t[c-1][2]>e;c--)t[c]=t[c-1];t[c]=[s,o,e]},i.n=t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return i.d(a,{a}),a},i.d=(t,a)=>{for(var s in a)i.o(a,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:a[s]})},i.f={},i.e=t=>Promise.all(Object.keys(i.f).reduce(((a,s)=>(i.f[s](t,a),a)),[])),i.u=t=>t+".infra3dapi.js",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,a)=>Object.prototype.hasOwnProperty.call(t,a),i.p="",(()=>{var t={80:1};i.f.i=(a,s)=>{t[a]||importScripts(i.p+i.u(a))};var a=self.webpackChunkinfra3dapi=self.webpackChunkinfra3dapi||[],s=a.push.bind(a);a.push=a=>{var o=a[0],e=a[1],h=a[2];for(var r in e)i.o(e,r)&&(i.m[r]=e[r]);for(h&&h(i);o.length;)t[o.pop()]=1;s(a)}})(),a=i.x,i.x=()=>i.e(505).then(a),i.x()})()));
|
package/README.md
CHANGED
|
@@ -1,42 +1,66 @@
|
|
|
1
|
-
# Installation
|
|
2
|
-
|
|
3
|
-
### NPM Package
|
|
4
|
-
|
|
5
|
-
The API can be installed as a package using npm. To install it from the npm package repository, simply type:
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @inovitas/infra3dapi
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
### CDN Download
|
|
12
|
-
|
|
13
|
-
Alternatively, you can obtain the API from a CDN. To get the latest version, add the following script to your HTML file:
|
|
14
|
-
|
|
15
|
-
```html
|
|
16
|
-
<script src="https://cdn.jsdelivr.net/npm/@inovitas/infra3dapi@latest/infra3dapi.js"></script>
|
|
17
|
-
```
|
|
1
|
+
# Installation
|
|
2
|
+
|
|
3
|
+
### NPM Package
|
|
4
|
+
|
|
5
|
+
The API can be installed as a package using npm. To install it from the npm package repository, simply type:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @inovitas/infra3dapi
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### CDN Download
|
|
12
|
+
|
|
13
|
+
Alternatively, you can obtain the API from a CDN. To get the latest version, add the following script to your HTML file:
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<script src="https://cdn.jsdelivr.net/npm/@inovitas/infra3dapi@latest/infra3dapi.js"></script>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
We recommend using a specific version in your project. To get a specific version, use the following script and adjust the version accordingly:
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<script src="https://cdn.jsdelivr.net/npm/@inovitas/infra3dapi@1.0.1/infra3dapi.js"></script>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Note**: Please do not name the `<div>` in which the viewer is initialized as "infra3d" as this may cause internal conflicts.
|
|
26
|
+
|
|
27
|
+
# Core Concept
|
|
28
|
+
|
|
29
|
+
To use the API, you can call the init functions in infra3dapi. After loggin in and initializing the view (with [`manager.initView()`](classes/_inovitas_infra3dapi.manager.Manager.html#initView)), you will get a viewer object. This viewer object can then be used to add event-listeners to different events emitted by the viewer (like [`viewer.geoframechanged`](classes/_inovitas_infra3dsdk.Viewer.html#geoframechanged)) or to call some functions (like [`viewer.getRoutes()`](classes/_inovitas_infra3dsdk.Viewer.html#getRoutes) or [`viewer.movePosition()`](classes/_inovitas_infra3dsdk.Viewer.html#movePosition)).
|
|
30
|
+
|
|
31
|
+
# Authentication
|
|
32
|
+
|
|
33
|
+
1. Register your OAuth 2.0 application with our sales team to obtain credentials (client_id and client_secret).
|
|
34
|
+
2. Develop a server-side component to securely use these credentials, obtaining an access token from infra3D.
|
|
35
|
+
3. Your server-side component fetches the access token using client credentials, which can then be shared with your client app.
|
|
36
|
+
4. Your client app uses this token to authenticate with infra3D for requested services, refreshing it via the server component when expired. Remember to treat the client_secret like a password, avoiding exposure in client-side environments for enhanced security.
|
|
37
|
+
|
|
38
|
+
# Changelog
|
|
39
|
+
|
|
40
|
+
## 1.1.0 - 09.10.2024
|
|
18
41
|
|
|
19
|
-
|
|
42
|
+
### Bugfixes
|
|
20
43
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```
|
|
44
|
+
- Bug in viewer.getRoutesOutline() when using as migrated user.
|
|
45
|
+
- Same default EPSG-Code (4326) when using start-position for (un)-migrated users.
|
|
24
46
|
|
|
25
|
-
|
|
47
|
+
### Added
|
|
26
48
|
|
|
27
|
-
|
|
49
|
+
- ProjectScope is available to restrict the access inside a project accordingly.
|
|
50
|
+
- New concept for routes abstraction in the map, using hexagons
|
|
51
|
+
- viewer.getRouteLines() and viewer.getRouteHexes()
|
|
52
|
+
- PointCloudExport
|
|
53
|
+
- Support of EPSG-Code in start-position
|
|
28
54
|
|
|
29
|
-
|
|
55
|
+
## 1.0.3 - 17.09.2024
|
|
30
56
|
|
|
31
|
-
|
|
57
|
+
### Bugfixes
|
|
32
58
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
59
|
+
- Fixed pilegate URL for migrated users.
|
|
60
|
+
- Using the profiletool, added an information and reset the tool when changing the image while performing a measurement.
|
|
61
|
+
- Fix the bug when using jest for testing.
|
|
62
|
+
- Added missing bounding box parameter to viewer.getRoutes().
|
|
37
63
|
|
|
38
|
-
# Changelog
|
|
39
|
-
|
|
40
64
|
## 1.0.2 - 06.08.2024
|
|
41
65
|
|
|
42
66
|
### Bugfixes
|
package/infra3dapi.d.ts
CHANGED
|
@@ -1,153 +1,154 @@
|
|
|
1
|
-
declare module "@inovitas/infra3dapi";
|
|
2
|
-
|
|
3
|
-
declare type Fn = (arg: any) => void;
|
|
4
|
-
declare class EventEmitter {
|
|
5
|
-
protected _events: {
|
|
6
|
-
[eventType: string]: Fn[];
|
|
7
|
-
};
|
|
8
|
-
constructor();
|
|
9
|
-
on(eventType: string, fn: Fn): void;
|
|
10
|
-
off(eventType: string, fn: Fn): void;
|
|
11
|
-
fire(eventType: string, data: unknown): void;
|
|
12
|
-
private _listens;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
declare type ViewerEventType = "nodechanged" | "panorotationchanged" | "campaignschanged" | "lookazimuthchanged";
|
|
16
|
-
|
|
17
|
-
interface IViewer {
|
|
18
|
-
fire<T>(type: ViewerEventType, event: T): void;
|
|
19
|
-
off<T>(type: ViewerEventType, handler: (event: T) => void): void;
|
|
20
|
-
on<T>(type: ViewerEventType, handler: (event: T) => void): void;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface ViewerEvent {
|
|
24
|
-
target: IViewer;
|
|
25
|
-
type: ViewerEventType;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface NodechangedEvent extends ViewerEvent {
|
|
29
|
-
lat: number;
|
|
30
|
-
lon: number;
|
|
31
|
-
height: number;
|
|
32
|
-
campaign_id: string;
|
|
33
|
-
date: string;
|
|
34
|
-
type: "nodechanged";
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
interface CampaignschangedEvent extends ViewerEvent {
|
|
38
|
-
id: number;
|
|
39
|
-
|
|
40
|
-
project: number;
|
|
41
|
-
|
|
42
|
-
description: string;
|
|
43
|
-
|
|
44
|
-
type: "campaignschanged";
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
fov: number;
|
|
49
|
-
|
|
50
|
-
lat: number;
|
|
51
|
-
|
|
52
|
-
lon: number;
|
|
53
|
-
|
|
54
|
-
type: "panorotationchanged";
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
value: number;
|
|
59
|
-
|
|
60
|
-
type: "lookazimuthchanged";
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
declare class InternalViewer {}
|
|
64
|
-
declare class GeoJSON {}
|
|
65
|
-
declare class ApmBase {}
|
|
66
|
-
|
|
67
|
-
declare class Viewer extends EventEmitter implements IViewer {
|
|
68
|
-
private _sdk_viewer;
|
|
69
|
-
constructor(sdk_viewer: InternalViewer);
|
|
70
|
-
moveToCampaign(campaignID: string): Promise<void>;
|
|
71
|
-
moveToPosition(easting: number, northing: number, height?: number, maxdist?: number, epsg?: number): Promise<void>;
|
|
72
|
-
lookAtPosition(easting: number, northing: number, height?: number, maxdist?: number, epsg?: number): Promise<void>;
|
|
73
|
-
getRoutes(simplify?: number): Promise<GeoJSON>;
|
|
74
|
-
attachToMeasurementTool(toolname: "lengthMeasure" | "areaMeasure", onmeasured: (value: number, geometry: number[][]) => void): void;
|
|
75
|
-
attachToMeasurementTool(toolname: "pointMeasure", onmeasured: (value: undefined, geometry: number[]) => void): void;
|
|
76
|
-
private _processMeasurementResult;
|
|
77
|
-
off(type: "nodechanged", handler: (event: NodechangedEvent) => void): void;
|
|
78
|
-
off(type: "campaignschanged", handler: (event: CampaignschangedEvent) => void): void;
|
|
79
|
-
off(type: "panorotationchanged", handler: (event: PanorotationchangedEvent) => void): void;
|
|
80
|
-
off(type: "lookazimuthchanged", handler: (event: LookazimuthchangedEvent) => void): void;
|
|
81
|
-
on(type: "nodechanged", handler: (event: NodechangedEvent) => void): void;
|
|
82
|
-
on(type: "campaignschanged", handler: (event: CampaignschangedEvent) => void): void;
|
|
83
|
-
on(type: "panorotationchanged", handler: (event: PanorotationchangedEvent) => void): void;
|
|
84
|
-
on(type: "lookazimuthchanged", handler: (event: LookazimuthchangedEvent) => void): void;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
declare type applicationProps = {
|
|
88
|
-
name: string;
|
|
89
|
-
url: string;
|
|
90
|
-
};
|
|
91
|
-
declare type cardProps = {
|
|
92
|
-
uid: string;
|
|
93
|
-
name: string;
|
|
94
|
-
description: string;
|
|
95
|
-
applications: applicationProps[];
|
|
96
|
-
created_by: string;
|
|
97
|
-
creation_date: string | Date;
|
|
98
|
-
tags: Array<{
|
|
99
|
-
name: string;
|
|
100
|
-
font_color: string;
|
|
101
|
-
background_color: string;
|
|
102
|
-
}>;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
declare class Manager extends EventEmitter {
|
|
106
|
-
static viewinitialized: string;
|
|
107
|
-
static viewerset: string;
|
|
108
|
-
static tokenset: string;
|
|
109
|
-
private _apm;
|
|
110
|
-
private _tokens;
|
|
111
|
-
constructor(apm: ApmBase);
|
|
112
|
-
initViewer(options: {
|
|
113
|
-
project_uid: string;
|
|
114
|
-
start_position?: {
|
|
115
|
-
easting: number;
|
|
116
|
-
northing: number;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
export declare function
|
|
1
|
+
declare module "@inovitas/infra3dapi";
|
|
2
|
+
|
|
3
|
+
declare type Fn = (arg: any) => void;
|
|
4
|
+
declare class EventEmitter {
|
|
5
|
+
protected _events: {
|
|
6
|
+
[eventType: string]: Fn[];
|
|
7
|
+
};
|
|
8
|
+
constructor();
|
|
9
|
+
on(eventType: string, fn: Fn): void;
|
|
10
|
+
off(eventType: string, fn: Fn): void;
|
|
11
|
+
fire(eventType: string, data: unknown): void;
|
|
12
|
+
private _listens;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare type ViewerEventType = "nodechanged" | "panorotationchanged" | "campaignschanged" | "lookazimuthchanged";
|
|
16
|
+
|
|
17
|
+
interface IViewer {
|
|
18
|
+
fire<T>(type: ViewerEventType, event: T): void;
|
|
19
|
+
off<T>(type: ViewerEventType, handler: (event: T) => void): void;
|
|
20
|
+
on<T>(type: ViewerEventType, handler: (event: T) => void): void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface ViewerEvent {
|
|
24
|
+
target: IViewer;
|
|
25
|
+
type: ViewerEventType;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface NodechangedEvent extends ViewerEvent {
|
|
29
|
+
lat: number;
|
|
30
|
+
lon: number;
|
|
31
|
+
height: number;
|
|
32
|
+
campaign_id: string;
|
|
33
|
+
date: string;
|
|
34
|
+
type: "nodechanged";
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface CampaignschangedEvent extends ViewerEvent {
|
|
38
|
+
id: number;
|
|
39
|
+
|
|
40
|
+
project: number;
|
|
41
|
+
|
|
42
|
+
description: string;
|
|
43
|
+
|
|
44
|
+
type: "campaignschanged";
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface PanorotationchangedEvent extends ViewerEvent {
|
|
48
|
+
fov: number;
|
|
49
|
+
|
|
50
|
+
lat: number;
|
|
51
|
+
|
|
52
|
+
lon: number;
|
|
53
|
+
|
|
54
|
+
type: "panorotationchanged";
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface LookazimuthchangedEvent extends ViewerEvent {
|
|
58
|
+
value: number;
|
|
59
|
+
|
|
60
|
+
type: "lookazimuthchanged";
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
declare class InternalViewer { }
|
|
64
|
+
declare class GeoJSON { }
|
|
65
|
+
declare class ApmBase { }
|
|
66
|
+
|
|
67
|
+
declare class Viewer extends EventEmitter implements IViewer {
|
|
68
|
+
private _sdk_viewer;
|
|
69
|
+
constructor(sdk_viewer: InternalViewer);
|
|
70
|
+
moveToCampaign(campaignID: string): Promise<void>;
|
|
71
|
+
moveToPosition(easting: number, northing: number, height?: number, maxdist?: number, epsg?: number): Promise<void>;
|
|
72
|
+
lookAtPosition(easting: number, northing: number, height?: number, maxdist?: number, epsg?: number): Promise<void>;
|
|
73
|
+
getRoutes(simplify?: number): Promise<GeoJSON>;
|
|
74
|
+
attachToMeasurementTool(toolname: "lengthMeasure" | "areaMeasure", onmeasured: (value: number, geometry: number[][]) => void): void;
|
|
75
|
+
attachToMeasurementTool(toolname: "pointMeasure", onmeasured: (value: undefined, geometry: number[]) => void): void;
|
|
76
|
+
private _processMeasurementResult;
|
|
77
|
+
off(type: "nodechanged", handler: (event: NodechangedEvent) => void): void;
|
|
78
|
+
off(type: "campaignschanged", handler: (event: CampaignschangedEvent) => void): void;
|
|
79
|
+
off(type: "panorotationchanged", handler: (event: PanorotationchangedEvent) => void): void;
|
|
80
|
+
off(type: "lookazimuthchanged", handler: (event: LookazimuthchangedEvent) => void): void;
|
|
81
|
+
on(type: "nodechanged", handler: (event: NodechangedEvent) => void): void;
|
|
82
|
+
on(type: "campaignschanged", handler: (event: CampaignschangedEvent) => void): void;
|
|
83
|
+
on(type: "panorotationchanged", handler: (event: PanorotationchangedEvent) => void): void;
|
|
84
|
+
on(type: "lookazimuthchanged", handler: (event: LookazimuthchangedEvent) => void): void;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
declare type applicationProps = {
|
|
88
|
+
name: string;
|
|
89
|
+
url: string;
|
|
90
|
+
};
|
|
91
|
+
declare type cardProps = {
|
|
92
|
+
uid: string;
|
|
93
|
+
name: string;
|
|
94
|
+
description: string;
|
|
95
|
+
applications: applicationProps[];
|
|
96
|
+
created_by: string;
|
|
97
|
+
creation_date: string | Date;
|
|
98
|
+
tags: Array<{
|
|
99
|
+
name: string;
|
|
100
|
+
font_color: string;
|
|
101
|
+
background_color: string;
|
|
102
|
+
}>;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
declare class Manager extends EventEmitter {
|
|
106
|
+
static viewinitialized: string;
|
|
107
|
+
static viewerset: string;
|
|
108
|
+
static tokenset: string;
|
|
109
|
+
private _apm;
|
|
110
|
+
private _tokens;
|
|
111
|
+
constructor(apm: ApmBase);
|
|
112
|
+
initViewer(options: {
|
|
113
|
+
project_uid: string;
|
|
114
|
+
start_position?: {
|
|
115
|
+
easting: number;
|
|
116
|
+
northing: number;
|
|
117
|
+
epsg?: number;
|
|
118
|
+
};
|
|
119
|
+
start_campaign?: {
|
|
120
|
+
id: string;
|
|
121
|
+
};
|
|
122
|
+
map_expand?: boolean;
|
|
123
|
+
show_cockpit?: boolean;
|
|
124
|
+
show_mapWindow?: boolean;
|
|
125
|
+
show_toolbar?: boolean;
|
|
126
|
+
toolbar?: string;
|
|
127
|
+
show_topbar?: boolean;
|
|
128
|
+
}): Promise<Viewer>;
|
|
129
|
+
getProjects(): Promise<cardProps[]>;
|
|
130
|
+
setViewer(viewer: InternalViewer): void;
|
|
131
|
+
setTokens(tokens: any): void;
|
|
132
|
+
setApmUserContext(userContext?: {
|
|
133
|
+
id?: string;
|
|
134
|
+
username?: string;
|
|
135
|
+
email?: string;
|
|
136
|
+
}): void;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
declare type accessTokenResponseType = {
|
|
140
|
+
access_token: string;
|
|
141
|
+
expires_in: number;
|
|
142
|
+
token_type: "Bearer";
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export declare function getAccessToken(url: string, client_id: string, client_secret: string): Promise<accessTokenResponseType>;
|
|
146
|
+
|
|
147
|
+
export declare function init(rootId: string, token: string, userContext?: {
|
|
148
|
+
id?: string;
|
|
149
|
+
username?: string;
|
|
150
|
+
email?: string;
|
|
151
|
+
}): Promise<Manager>;
|
|
152
|
+
export declare function getManager(): Manager;
|
|
153
|
+
export declare function getGuestAccessToken(): Promise<accessTokenResponseType>;
|
|
153
154
|
export declare function refreshToken(token: string): void;
|