C#C
C#3y ago
Sebastian

❔ ✅ Applying math to programming

Hi,
this is not necessarily a C# question and more question towards math and programming. I am using C# as my language so I hope it's okay to ask this here.

I have always been struggling with applying math equations and so on to programming and I am finally tackling this mental block I have and trying to force myself to learn more.

I have a 2 dimensional array (grid) of 0 or 1 (which size is set dynamically)
I would like to use x^4 + y^4 = 1 to fill it out.
https://www.wolframalpha.com/input?i=x%5E4+%2B+y%5E4+%3D+1

How can I draw this shape in it?
I would also like to go beyond and how could I fill it out or reverse fill it out in my grid?
Just a small pointer on how to use math to achieve some different result would help help so much.
Thank you.

Example (With bigger size edges would be smoother):
1 1 1 1 1 1 1 1 1 1
1 1 0 0 0 0 0 0 1 1
1 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 1
1 1 0 0 0 0 0 0 1 1
1 1 1 1 1 1 1 1 1 1
Was this page helpful?