Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's just awesome, everyone try the reticulum example!


reticulum variation:

    f:{
      x.z+:((frame + x.x*sin 0.03* frame + x.y*cos 0.2 * frame)*.03); a:x.z^0.94
      x.xy*:mat[cos a;sin a;-sin a;cos a]
      .02-#(cos x.xy)+sin x.yz
    }
    p: 70{x+f[x]*0.5-(pos.xy;340)%size.x}/(0;0;0)
    col:((3;5;1)%#p),1

Can anyone give a bit of intuition behind the following construction in reticulum?

    p:32{x+f[x]*.5-(pos.xy;1)%size.x}/0 0 0
It appears to be some kind of fixed-point iterative approximation: we initialise an accumulator with the zero vec3 (0;0;0) then transform it 32 times by iteratively mapping it by lambda : vec3 -> vec3 where lambda(x) := x+f[x]*.5-(pos.xy;1)%size.x

So if we crank up the number of iterations from 32 to 64 or 1000 or whatever we get a better approximation of the limit, but it looks better -- due to the fuzzier edges -- after a modest number of iterations. (it also takes a lot less effort to compute the fewer iterations we do).


A few recognizable parts:

    *.5-(pos.xy;1)%size.x
This produces a vec3 of the screen-space coordinates of the fragment, scaled to a -0.5 to 0.5 range (assuming a square display) and the z component will be the scaling factor. This also happens to invert the axes, which doesn't matter.

    x.xy*:mat[cos a;sin a;-sin a;cos a]
This is a standard 2d rotation matrix- rotate the position xy about the origin by angle a.

Your comment is a good description of the overall algorithm.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: