0x18b75119…b783sent to0x381233d5…7acd·#19,594,897·view on Etherscan
[0,()=>{console.log("Artist 40. Jacek Markusiewicz -- platform 0");(()=>{
R=Random(),console.log("%cRatio","font-weight: bold"),console.log("%cAdd parameters w (width) and h (height) to the end of the URL address to obtain a desired resolution, e.g. ?w=1350&h=2400. The algorithm will adjust the size to the aspect ratio of 9:16.","font-style: italic"),console.log("%cAll drawing and geometric methods by Jacek Markusiewicz except ray-cylinder intersection [by Inigo Quilez, MIT License]","font-style: italic"),console.log("Seed: "+tokenData.hash);class t{constructor(t,n){this.O=t,this.D=n,this.X0=n.length<1||0==n[0],this.Y0=n.length<2||0==n[1],this.Z0=n.length<3||0==n[2],this.iX=this.X0?0:1/n[0],this.iY=this.Y0?0:1/n[1],this.iZ=this.Z0?0:1/n[2]}}class n{constructor(t,n,e,o,h,s){this.X=[t,n],this.Y=[e,o],this.Z=[h,s]}flip(t,n){if(!n)return t;const e=[];for(let n=0;n<t.length;n++)e.push(t[n]);if(e.length>=6)for(let t=0;t<Math.min(3,e[5].length);t++)e[5][t]*=-1;return e}hit(t,n){const e=[],o=et(this.X[0],t),h=et(this.X[1],t),s=nt(this.Y[0],t),r=nt(this.Y[1],t),i=tt(this.Z[0],t),l=tt(this.Z[1],t);return o[3]&&o[1]>=this.Y[0]&&o[1]<=this.Y[1]&&o[2]>=this.Z[0]&&o[2]<=this.Z[1]&&e.push(this.flip(o,!n)),h[3]&&h[1]>=this.Y[0]&&h[1]<=this.Y[1]&&h[2]>=this.Z[0]&&h[2]<=this.Z[1]&&e.push(this.flip(h,!!n)),s[3]&&s[0]>this.X[0]&&s[0]<this.X[1]&&s[2]>=this.Z[0]&&s[2]<=this.Z[1]&&e.push(this.flip(s,!n)),r[3]&&r[0]>this.X[0]&&r[0]<this.X[1]&&r[2]>=this.Z[0]&&r[2]<=this.Z[1]&&e.push(this.flip(r,!!n)),i[3]&&i[0]>this.X[0]&&i[0]<this.X[1]&&i[1]>this.Y[0]&&i[1]<this.Y[1]&&e.push(this.flip(i,!n)),l[3]&&l[0]>this.X[0]&&l[0]<this.X[1]&&l[1]>this.Y[0]&&l[1]<this.Y[1]&&e.push(this.flip(l,!!n)),2!=e.length?0!=e.length?(e.sort((function(t,n){return t[4]-n[4]})),[[e[0],e[e.length-1]]]):[]:e[0][4]<e[1][4]?[e]:[[e[1],e[0]]]}}class e{constructor(t,n,e){this.r=e,this.r2=e*e,this.pt=t,this.axis=n}hit(t,n){const e=function(t,n,e,o){const h=G(n,t.O),s=V(e,t.D),r=V(e,h),i=1-s*s,l=V(h,h)-r*r-o;if(Math.abs(i)<1e-4){if(l>0)return[[0,0,0,!1,-10],[0,0,0,!1,-10]];{const n=J(t.O,t.D,-999),e=J(t.O,t.D,999);return[[n[0],n[1],n[2],!0,-999],[e[0],e[1],e[2],!0,999]]}}const a=V(h,t.D)-r*s;let c=a*a-i*l;if(c<1e-4)return[[0,0,0,!1,-10],[0,0,0,!1,-10]];c=Math.sqrt(c);const u=1/i,f=(-a-c)*u,M=(-a+c)*u;let d=f,m=M;M<f&&(d=M,m=f);return[[t.O[0]+d*t.D[0],t.O[1]+d*t.D[1],t.O[2]+d*t.D[2],!0,d],[t.O[0]+m*t.D[0],t.O[1]+m*t.D[1],t.O[2]+m*t.D[2],!0,m]]}(t,this.pt,this.axis,this.r2);return!e||e.length<2||!e[0][3]||!e[1][3]?[]:(e[0].push(this.getNormal(e[0],n)),e[1].push(this.getNormal(e[1],n)),[e])}getNormal(t,n){const e=V(G(this.pt,t),this.axis);let o=$(G(J(this.pt,this.axis,e),t));return n&&(o=[-o[0],-o[1],-o[2]]),o.push(e),o}}class o{constructor(t,n,e,o,h){this.x0=t,this.x1=t+o,this.y0=n,this.y1=n+o,this.z0=e,this.z1=e+h,this.isEmpty=!0,this.sub=[]}copyPt(t){const n=[],e=this.shouldFlipNormal(t);for(let e=0;e<t.length;e++)if(5!=e)n.push(t[e]);else{const o=[];for(let n=0;n<t[e].length;n++)o.push(t[e][n]);n.push(o)}if(n.length<5&&n.push([0,0,0,t[0],t[1]]),e)for(let t=0;t<Math.min(3,n[5].length);t++)n[5][t]*=-1;return n}shouldFlipNormal(t){return t[0]<=this.x0+.001||!(t[0]>=this.x1-.001)&&(t[1]<=this.y0+.001||!(t[1]>=this.y1-.001)&&(t[2]<=this.z0+.001||(t[2],this.z1,!1)))}Domains(t){const n=[];for(let e of this.sub){const o=e.hit(t,!0);for(let t of o)n.push(t)}return n}IntersectTerrain(t){for(let n of t)return[n[0][0],n[0][1],n[0][2],0,n[0][4],0,n[0][5]];return null}Intersect(t,n,e){const o=[[this.copyPt(t),this.copyPt(n)]],h=this.Domains(e),s=h&&h.length>0?(i=h,function(t,n,e,o){if(0==t.length)return[];if(0==n.length)return e;const h=[],s=[];for(let n=0;n<t.length;n++)h.push(t[n]),s.push(null!=e&&e.length==t.length?e[n]:t[n]);for(let t=0;t<n.length;t++)h.push(n[t]),s.push(null!=o&&o.length==n.length?o[t]:n[t]);const r=function(t){const n=[];for(let e=0;e<t.length;e++)n.push([t[e][0],e,0]),n.push([t[e][1],e,1]);return n.sort((function(t,n){return t[0]-n[0]})),n}(h),i=[];for(let e=0;e<r.length-1;e++){const o=.5*(r[e][0]+r[e+1][0]);i.push(ut(o,t)&&!ut(o,n))}return function(t,n,e){const o=[];let h=[-999,0,0],s=[-999,0,0],r=!1;for(let i=0;i<t.length-1;i++)n[i]&&(s=t[i+1],r||(h=t[i]),r=!0),n[i]&&i!=t.length-2||(r&&o.push([e[h[1]][h[2]],e[s[1]][s[2]]]),r=!1);return o}(r,i,s)}(it(r=o),it(i),r,i)):o;var r,i;return this.IntersectTerrain(s)}}const h=64,s=2.75,r=16,i=704,l=704,a=112,c=Math.atan(1/Math.SQRT2),u=B([0,1,0],c,Math.PI/4+Math.round(R.random_dec())*Math.PI),f=.82,M=205.12*Math.SQRT2;let d=0,m=64,g=self.innerWidth,p=self.innerHeight;const x=g/Math.max(1,p);try{const t=new URLSearchParams(window.location.search),n=t.get("h"),e=t.get("w");n&&(p=parseInt(n),console.log("set H to "+p)),e&&(g=parseInt(e),console.log("set W to "+g))}catch{g=self.innerWidth,p=self.innerHeight}const O=document.createElement("canvas");O.id="sumCanvas",O.style.maxWidth="100%",O.style.maxHeight="100%",O.style.zIndex=999;const y=O.getContext("2d");document.body.prepend(O);const w=document.createElement("canvas");w.id="mainCanvas",w.style.display="none";const D=w.getContext("2d",{willReadFrequently:!0});document.body.prepend(w);const _=document.createElement("canvas");_.id="saveCanvas",_.style.display="none";const b=_.getContext("2d");document.body.prepend(_),function(t,n,e,o){let h=Math.max(16*e,Math.min(8*e*Math.ceil(t/(8*e)),8*e*Math.ceil(n/(8*o)))),s=Math.round(o*h/e);console.log("best size for w="+t+", h="+n+" is "+h+"x"+s),w.width=Math.round(h),w.height=Math.round(s),O.width=w.width,O.height=w.height,_.width=w.width,_.height=w.height,d=0,m=64*Math.min(20,Math.round(Math.max(1,3e3/Math.max(1,w.height+w.width))))}(g,p,9,16);const Z=w.width,I=w.height,X=M/Z;let Y=[],v=[],S=[],T=.48,z=.51,E=.55,C=.7,P=.67,k=.65,A=.95,N=.9,Q=.75;const H=new class{constructor(t,n,e,o,h){this.planeO=[t,n,e],this.planeX=B([1,0,0],o,h),this.planeY=B([0,1,0],o,h),this.planeZ=B([0,0,1],o,h)}}(344,344,0,c,-Math.PI/4);H.planeO=J(H.planeO,H.planeZ,590);let W=!1;for(;!W;)try{Y=[];for(let t=0;t<687;t+=r){const n=[];for(let e=0;e<687;e+=r){const h=[];for(let n=0;n<111;n+=r)h.push(new o(t,e,n,r,r));n.push(h)}Y.push(n)}v=[],S=[];for(let t=0;t<705;t+=8){const o=Math.floor(t/8);S.push([]);for(let h=0;h<705;h+=8){0==t&&v.push([]);const a=Math.floor(h/8);for(let c=0;c<111;c+=r){if(0==t){const t=[],o=[0,h,c+r-s-.1];t.push(new e(o,[1,0,0],s)),t.push(new n(0,i,o[1]-s,o[1]+s,o[2]-8,o[2])),v[a].push(t)}if(0==h){const h=[],i=[t,0,c+r-s-.1];h.push(new e(i,[0,1,0],s)),h.push(new n(i[0]-s,i[0]+s,0,l,i[2]-8,i[2])),S[o].push(h)}}}}const t=[],h=[];for(let n=0;n<200;n++){const n=Math.floor(37.9*R.random_dec()),e=Math.floor(37.9*R.random_dec()),o=3+Math.floor(3.5*R.random_dec()),s=3+Math.floor(3.5*R.random_dec()),r=[[n,n+o],[e,e+s],[0,2+Math.floor(2.5*R.random_dec())]];if(lt(r,t))continue;t.push(r);const i=Math.round(2+(o-2)*R.random_dec()),l=Math.round(2+(s-2)*R.random_dec()),a=Math.round(R.random_dec())<.5,c=Math.round(R.random_dec())<.5,u=Math.floor(2+R.random_dec()*(7-r[2][1]-2.1));h.push([[a?n:n+o-i,a?n+i:n+o],[c?e:e+s-l,c?e+l:e+s],[r[2][1],r[2][1]+u]])}for(let n of h)t.push(n);for(let n of t)for(let t=n[0][0];t<Math.min(Y.length,n[0][1]);t++)for(let e=n[1][0];e<Math.min(Y[t].length,n[1][1]);e++)for(let o=n[2][0];o<Math.min(Y[t][e].length,n[2][1]);o++){if(Y[t][e][o].isEmpty=!1,t>n[0][0]+.1)for(let n of S[2*t][o])Y[t][e][o].sub.push(n);if(e>n[1][0]+.1)for(let n of v[2*e][o])Y[t][e][o].sub.push(n);for(let n of S[2*t+1][o])Y[t][e][o].sub.push(n);for(let n of v[2*e+1][o])Y[t][e][o].sub.push(n);if(t<n[0][1]-1.1)for(let n of S[2*t+2][o])Y[t][e][o].sub.push(n);if(e<n[1][1]-1.1)for(let n of v[2*e+2][o])Y[t][e][o].sub.push(n)}for(let t=0;t<Y.length;t++)for(let n=0;n<Y[t].length;n++)for(let e=Y[t][n].length-1;e>0;e--)Y[t][n][e].isEmpty&&!Y[t][n][e-1].isEmpty&&(Y[t][n][e].isEmpty=!1);let a=(Math.floor(4.9*R.random_dec())-2)/2,c=(Math.floor(4.9*R.random_dec())-2)/2;Math.sign(a)==Math.sign(c)&&(c*=-1),T=.51+.05*a,z=.51-.05*(a+c),E=.51+.05*c,a=(Math.floor(4.9*R.random_dec())-2)/2,c=(Math.floor(4.9*R.random_dec())-2)/2,Math.sign(a)==Math.sign(c)&&(c*=-1),C=.55+.04*a,P=.55-.04*(a+c),k=.55+.04*c,a=(Math.floor(4.9*R.random_dec())-2)/2,c=(Math.floor(4.9*R.random_dec())-2)/2,Math.sign(a)==Math.sign(c)&&(c*=-1),A=.9+.08*a,N=.9-.08*(a+c),Q=.9+.08*c,document.body.style.backgroundColor=x<1?"#ffffff":"rgb("+Math.round(85*(C+.7+A))+","+Math.round(85*(P+.7+N))+","+Math.round(85*(k+.7+Q))+")",W=!0;break}catch(t){console.log(t),W=!1}function q(t,n,e){const o=[],h=Math.min(3,t.length,n.length);for(let s=0;s<h;s++)o.push(t[s]-e*(1-n[s]));return o}function F(t,n,e){const o=[],h=Math.min(3,t.length,n.length);for(let s=0;s<h;s++)o.push(t[s]+e*n[s]);return o}function L(t,n,e){const o=[],h=Math.min(3,t.length,n.length);for(let s=0;s<h;s++)o.push(t[s]+e*(n[s]-t[s]));return o}function U(n){let e=J(n,n[6],.02+.02*R.random_dec()),o=.5*(.5*V(n[6],B(u,R.random_dec()-.5,R.random_dec()-.5))+1)-.5;const h=rt(new t(e,B(u,.005*(R.random_dec()-.5),.005*(R.random_dec()-.5))),i/1.5,!0);return o+=null!=h?Math.min(1,h[4]/(i/1.5)):1,1.125*(o+.125)}function j(t,n,e){const o=Math.sin(e),h=Math.cos(e);return[t*h-n*o,t*o+n*h]}function B(t,n,e){const o=j(t[1],t[2],n),h=j(t[0],o[0],e);return[h[0],h[1],o[1]]}function J(t,n,e){const o=Math.min(t.length,n.length,3),h=[];for(let s=0;s<o;s++)h.push(t[s]+e*n[s]);return h}function G(t,n){const e=Math.min(t.length,n.length,3),o=[];for(let h=0;h<e;h++)o.push(n[h]-t[h]);return o}function K(t,n,e){const o=Math.min(t.length,n.length,3),h=[];for(let s=0;s<o;s++)h.push(t[s]+e*(n[s]-t[s]));return h}function V(t,n){const e=Math.min(t.length,n.length,3);let o=0;for(let h=0;h<e;h++)o+=t[h]*n[h];return o}function $(t){const n=Math.min(3,t.length);let e=0;for(let o=0;o<n;o++)e+=t[o]*t[o];if(e>1e-5){const o=1/Math.sqrt(e),h=[];for(let e=0;e<n;e++)h.push(t[e]*o);return h}return[0,0,0]}function tt(t,n){if(n.Z0)return[0,0,0,!1,-10,[0,0,0,0,0]];const e=(t-n.O[2])*n.iZ,o=n.O[0]+e*n.D[0],h=n.O[1]+e*n.D[1];return[o,h,n.O[2]+e*n.D[2],!0,e,[0,0,1,o,h]]}function nt(t,n){if(n.Y0)return[0,0,0,!1,-10,[0,0,0,0,0]];const e=(t-n.O[1])*n.iY,o=n.O[0]+e*n.D[0],h=n.O[1]+e*n.D[1],s=n.O[2]+e*n.D[2];return[o,h,s,!0,e,[0,1,0,o,s]]}function et(t,n){if(n.X0)return[0,0,0,!1,-10,[0,0,0,0,0]];const e=(t-n.O[0])*n.iX,o=n.O[0]+e*n.D[0],h=n.O[1]+e*n.D[1],s=n.O[2]+e*n.D[2];return[o,h,s,!0,e,[1,0,0,h,s]]}function ot(t,n,e,o,h,s,r){return!t||t.length<3?null:!(t[0]<n-.01)&&(!(t[1]<o-.01)&&(!(t[2]<s-.01)&&(!(t[0]>e+.01)&&(!(t[1]>h+.01)&&!(t[2]>r+.01)))))}function ht(t){if(!t||t.length<3)return null;const n=Math.floor(t[0]/r);if(n<0||n>=Y.length)return null;const e=Math.floor(t[1]/r);if(e<0||e>=Y[n].length)return null;const o=Math.floor(t[2]/r);if(o<0||o>=Y[n][e].length)return null;const h=Y[n][e][o];return!h||h.isEmpty?null:h}function st(t,n,e,o,h){let s=4*e*(o-1-n-h)+4*t;return[s,s+1,s+2,s+3]}function rt(t,n,e){let o=0;o=t.D[0]>=0?Math.min(688,Math.max(Math.floor((t.O[0]+.001)/r)*r,0)):Math.min(688,Math.max(0,Math.floor((t.O[0]+.001-n)/r)*r));let h=0;h=t.D[0]<=0?Math.max(0,Math.min(Math.ceil((t.O[0]-.001)/r)*r,688)):Math.max(0,Math.min(688,Math.ceil((t.O[0]-.001+n)/r)*r));let s=0;s=t.D[1]>=0?Math.min(688,Math.max(Math.floor((t.O[1]+.001)/r)*r,0)):Math.min(688,Math.max(0,Math.floor((t.O[1]+.001-n)/r)*r));let i=0;i=t.D[1]<=0?Math.max(0,Math.min(Math.ceil((t.O[1]-.001)/r)*r,688)):Math.max(0,Math.min(688,Math.ceil((t.O[1]-.001+n)/r)*r));let l=0;l=t.D[2]>=0?Math.min(a,Math.max(Math.floor((t.O[2]+.001)/r)*r,0)):Math.min(a,Math.max(0,Math.floor((t.O[2]+.001-n)/r)*r));let c=0;c=t.D[2]<=0?Math.max(0,Math.min(Math.ceil((t.O[2]-.001)/r)*r,a)):Math.max(0,Math.min(a,Math.ceil((t.O[2]-.001+n)/r)*r));const u=[];if(e&&u.push([t.O[0],t.O[1],t.O[2],!0,0,[0,0,0,t.O[0],t.O[1]]]),i-s>.001)for(let n=s;n<i+1;n+=i-s){const e=nt(n,t);e[3]&&(e[4]<=0||ot(e,o,h,s,i,l,c)&&u.push(e))}if(h-o>.001)for(let n=o;n<h+1;n+=h-o){const e=et(n,t);e[3]&&(e[4]<=0||ot(e,o,h,s,i,l,c)&&u.push(e))}if(c-l>.001)for(let n=l;n<c+1;n+=c-l){const e=tt(n,t);e[3]&&(e[4]<=0||ot(e,o,h,s,i,l,c)&&u.push(e))}if(u.length<2)return null;let f=9999,M=-9999,d=9999,m=-9999,g=9999,p=-9999;for(let t=0;t<u.length;t++){const n=u[t][0],e=u[t][1],o=u[t][2];f>n&&(f=n),d>e&&(d=e),g>o&&(g=o),M<n&&(M=n),m<e&&(m=e),p<o&&(p=o)}f=Math.max(o,Math.floor((f+.01)/r)*r),d=Math.max(s,Math.floor((d+.01)/r)*r),g=Math.max(l,Math.floor((g+.01)/r)*r),M=Math.min(h,Math.ceil((M-.01)/r)*r),m=Math.min(i,Math.ceil((m-.01)/r)*r),p=Math.min(c,Math.ceil((p-.01)/r)*r);for(let n=d;n<m+1;n+=r){if(n==s||n==i)continue;const e=nt(n,t);e[3]&&(e[4]<=0||ot(e,f,M,d,m,g,p)&&u.push(e))}for(let n=f;n<M+1;n+=r){if(n==o||n==h)continue;const e=et(n,t);e[3]&&(e[4]<=0||ot(e,f,M,d,m,g,p)&&u.push(e))}for(let n=g;n<p+1;n+=r){if(n==l||n==c)continue;const e=tt(n,t);e[3]&&(e[4]<=0||ot(e,f,M,d,m,g,p)&&u.push(e))}if(u.length<2)return null;u.sort((function(t,n){return t[4]-n[4]}));for(let e=0;e<u.length-1&&!(u[e][4]>n);e++){const n=ht(K(u[e],u[e+1],.5));if(null!=n){const o=n.Intersect(u[e],u[e+1],t);if(null!=o)return o}}return null}function it(t){const n=[];for(let e of t)n.push([e[0][4],e[1][4]]);return n}function lt(t,n){for(let h of n)if(o=h,at((e=t)[0],o[0])&&at(e[1],o[1]))return!0;var e,o;return!1}function at(t,n){return ct(t[0],n)||ct(t[1],n)||ct(n[0],t)||ct(n[1],t)}function ct(t,n){return!(t<n[0])&&!(t>n[1])}function ut(t,n){for(let e of n)if(ct(t,e))return!0;return!1}console.log("render"),setInterval((function(){!function(){if(d<m)try{0==d&&(b.fillStyle="#ffffff",b.fillRect(-10,-10,Z+20,I+20)),function(n,e){0==n&&(D.fillStyle="#ffffff",D.fillRect(-10,-10,Z+20,I+20));const o=Math.floor(n/h),s=1/Math.max(1,o+1),i=H.planeY,l=H.planeX,a=[-H.planeZ[0],-H.planeZ[1],-H.planeZ[2]],u=Math.max(10,Math.round(1e6/Z));let d=Math.ceil(I/u),g=0,p=I;const x=Math.round(Z/2),O=-x,y=Math.round(I/2),w=Math.cos(c);for(let c=0;c<d;c++){const _=Math.min(u,p);try{console.log("rendering pass "+(n+1)+"/"+m+", fragment "+(c+1)+"/"+d)}catch{}g+=_,p-=_;const b=D.getImageData(0,p,Z,_),Y=b.data,v=-y+g-_,S=-y+g;for(let c=O;c<x;c++){const u=c+x,d=u%8*8;for(let m=v;m<S;m++){const g=m+y;if(d+g%8!=n%h)continue;const x=X*(c+(R.random_dec()-.5)),O=w*X*(m+(R.random_dec()-.5));let D=J(H.planeO,l,x);D=J(D,i,O);const _=st(u,g,Z,I,p),b=[Y[_[0]],Y[_[1]],Y[_[2]]];let v=[0,0,0],S=rt(new t(D,a),e,!1),W=0,j=null;if(null==S){if(j=tt(0,new t(D,a)),!j)continue;j=[j[0],j[1],j[2],0,j[4],0,[0,0,1,j[0],j[1]]],W+=j[4],S=rt(new t([j[0],j[1],j[2]],$([a[0],a[1],-a[2]])),e,!0),S&&(W+=S[4])}const B=Math.min(1,Math.max(0,(W-500)/200));let G=1;j&&(G=S?U(S)*U(j):U(j));let K=[T,z,E];v=q(L([C,P,k],F(K,[A,N,Q],Math.pow(B,.67)),.6*B),K,1-G),j||(v=[1,1,1]),Math.abs(x)>.5*M-13.12*Math.SQRT2/2&&(v=[1,1,1]),Math.abs(O)>.5*M*I*w/Z-f*w*r*Math.SQRT2/2&&(v=[1,1,1]),Y[_[0]]=(o*b[0]+255*v[0])*s,Y[_[1]]=(o*b[1]+255*v[1])*s,Y[_[2]]=(o*b[2]+255*v[2])*s}}D.putImageData(b,0,p)}}(d,5e3),b.drawImage(w,0,0)}catch(t){console.log(t),D.drawImage(_,0,0),d--}d<=m+1&&y.drawImage(w,0,0);try{if(d<m){const t=(d+1)/Math.max(1,m);y.fillStyle="rgb("+Math.round(100*(T+C))+","+Math.round(100*(z+P))+","+Math.round(100*(E+k))+")",y.font=.01*I+"px Arial Narrow, sans-serif",y.textAlign="center",y.fillText(Math.round(100*t)+"%",Z/2,.994*I)}}catch(t){console.log(t)}d++,d>2e5&&(d=2e5)}()}),80)})();
}],