4 ms·
Could you write a function so that for point (x,y) it returns true if the point is "in" the spierpinski triangle? Yes, I am wondering if it could be expressed a
by RantyDave 5y ago
Could you write a function so that for point (x,y) it returns true if the point is "in" the spierpinski triangle? Yes, I am wondering if it could be expressed as a fragment shader :)
- Sharlin 5y agoYou can exploit this nifty fact: in a pixel grid if you color a pixel at (x, y) based on whether (x & y) == y, you get a discrete, right-angled approximation of the Sierpinski triangle! Transform x and y appropriately to get the equilateral version. https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=a5a330e58597a62547621ee19b9c3adc https://play.rust-lang.org/?version=stable&mode=debug&editio... Edit: quick Shadertoy version: https://www.shadertoy.com/view/flVXDh https://www.shadertoy.com/view/flVXDh
- RantyDave 5y agoOMG you've actually done it! That's outrageous!