speice.io/assets/js/f8d03b4b.436bc33b.js

1 line
126 KiB
JavaScript
Raw Permalink Normal View History

"use strict";(self.webpackChunkspeice_io=self.webpackChunkspeice_io||[]).push([["6602"],{30218:function(s,e,a){a.r(e),a.d(e,{shiftData:()=>_,default:()=>T,assets:()=>M,coefs:()=>L,metadata:()=>n,frontMatter:()=>R,toData:()=>S,contentTitle:()=>z,toc:()=>A,simpleData:()=>F});var n=a("37144"),l=a("85893"),i=a("50065"),t=a("32042"),m=a("13772"),r=a("57536"),c=a("45342"),h=a("1618"),d=a("71004"),x=a("67"),p=a("86861"),j=a("40653"),o=a("87320"),N=a("67294");function g(s){let{f:e}=s,{width:a,height:n,setPainter:i}=(0,N.useContext)(o.wn);return(0,N.useEffect)(()=>{a&&n&&i(e({width:a,height:n}))},[a,n]),(0,l.jsx)(l.Fragment,{})}function u(s,e,a){var n,l,i,t,m;let[r,c]=(n=s,l=e,[Math.floor(n*(i=a.width)),Math.floor(l*i)]);if(r<0||r>=a.width||c<0||c>=a.height)return;let h=(t=r,m=c,4*a.width*m+4*t);a.data[h]=0,a.data[h+1]=0,a.data[h+2]=0,a.data[h+3]=255}var y=a("42974");let v={Gasket:function(s){let{f:e}=s;return(0,l.jsx)(o.ke,{name:"gasket",children:(0,l.jsx)(g,{f:e})})},plot:u,randomBiUnit:y.J,randomInteger:function(s,e){return Math.floor(Math.random()*(e-s))+s}};var f=a("37955"),w=a("22237"),b=a("57037");function k(){let[s,e]=(0,N.useState)(1),[a,n]=(0,N.useState)(1),[i,t]=(0,N.useState)(1),m=(s,e)=>[s/2,e/2],r=(s,e)=>[(s+1)/2,e/2],c=(s,e)=>[s/2,(e+1)/2],{width:h,height:d,setPainter:x}=(0,N.useContext)(o.wn);(0,N.useEffect)(()=>{x(function*(s){let{width:e,height:a,transforms:n}=s,l=new ImageData(e,a),[i,t]=[(0,y.J)(),(0,y.J)()],m=e*a*.5;for(let s=0;s<m;s++){let[e,a]=(0,f.m)(n);[i,t]=a(i,t),s>20&&u(i,t,l),s%1e3==0&&(yield l)}yield l}({width:h,height:d,transforms:[[s,m],[a,r],[i,c]]}))},[s,a,i]);let p=(s,e,a)=>(0,l.jsx)(l.Fragment,{children:(0,l.jsxs)("div",{className:b.Z.inputElement,children:[(0,l.jsxs)("p",{children:[(0,l.jsx)(w.Z,{children:s}),": ",e]}),(0,l.jsx)("input",{type:"range",min:0,max:1,step:.01,value:e,onInput:s=>a(Number(s.currentTarget.value))})]})});return(0,l.jsx)(l.Fragment,{children:(0,l.jsxs)("div",{className:b.Z.inputGroup,style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr"},children:[p("F_0",s,e),p("F_1",a,n),p("F_2",i,t)]})})}let R={slug:"2024/11/playing-with-fire",title:"Playing with fire: The fractal flame algorithm",date:new Date("2024-12-16T21:30:00.000Z"),authors:["bspeice"],tags:[]},z=void 0,M={authorsImageUrls:[void 0]},F=[{x:0,y:0},{x:1,y:1},{x:2,y:2}],L={a:1,b:0,c:.5,d:0,e:1,f:1.5},S=([s,e])=>({x:s,y:e}),_=F.map(({x:s,y:e})=>S((0,p.z)(s,e,L))),A=[{value:"Iterated function systems",id:"iterated-function-systems",level:2},{value:"Solution set",id:"solution-set",level:3},{value:"Transform functions",id:"transform-functions",level:3},{value:"Fixed set",id:"fixed-set",level:3},{value:"Sierpinski&#39;s gasket",id:"sierpinskis-gasket",level:2},{value:"The chaos game",id:"the-chaos-game",level:3},{value:"Plotting",id:"plotting",level:3},{value:"Weights",id:"weights",level:3},{value:"Summary",id:"summary",level:2}];function I(s){let e={a:"a",admonition:"admonition",annotation:"annotation",blockquote:"blockquote",code:"code",em:"em",h2:"h2",h3:"h3",hr:"hr",li:"li",math:"math",mfrac:"mfrac",mi:"mi",mn:"mn",mo:"mo",mrow:"mrow",mspace:"mspace",mstyle:"mstyle",msub:"msub",msup:"msup",mtable:"mtable",mtd:"mtd",mtext:"mtext",mtr:"mtr",munderover:"munderover",p:"p",semantics:"semantics",span:"span",strong:"strong",ul:"ul",...(0,i.a)(),...s.components},{Details:a}=e;return!a&&function(s,e){throw Error("Expected "+(e?"component":"object")+" `"+s+"` to be defined: you likely forgot to import, pass, or provide it.")}("Details",!0),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(e.p,{children:["Wikipedia describes ",(0,l.jsx)(e.a,{href:"https://en.wikipedia.org/wiki/Fractal_flame",children:"fractal flames"})," as:"]}),"\n",(0,l.jsxs)(e.blockquote,{children:["\n",(0,l.jsx)(e.p,{children:"a member of the iterated function system class of fractals"}),"\n"]}),"\n",(0,l.jsx)(e.p,{children:"It's tedious, but technically correct. I choose to think of them a different way: beauty in mathematics."}),"\n","\n",(0,l.jsx)("center",{children:(0,l.jsx)("img",{src:m.Z,style:{filter:(0,t.Z)()?"":"invert(1)"}})}),"\n",(0,l.jsx)(e.p,{ch