I'm using Blender 2.8 and trying to get a grasp on procedural textures. For fun, I was following through the list here at https://thndl.com/square-shaped-shaders.html and now I'm stuck.
Equation I'm trying to reproduce:
float a=atan(c.x,c.y);
f=vec4(step(.5,cos( floor(a*.636+.5)* 1.57-a)*length(c.xy)))
Result = A Square
I have a feeling it has to do with the Polar Coordinates, but I'm not sure where considering I believe the math is correct everywhere else.
Can someone take a look and see where the mistake is and perhaps explain though it if possible?
Thanks!
Shader Node Setup:
(Length = sqrt(x^2 + y^2)
The Result: