there are exactly 2 things in my experience as a programmer that make it feel really true to say that programming is mathematical
the first is program calculation/squiggol
but the other is shader programming
Discussion
there are exactly 2 things in my experience as a programmer that make it feel really true to say that programming is mathematical
the first is program calculation/squiggol
but the other is shader programming
to expand on this comment about shaders being mathematical:
whenever you're making stuff with shaders, you're constantly making use of very mathematical ideas to do things
if you want to draw a circle, for instance, you basically use the standard set theoretic definition
a circle of radius r at origin (x0,y0) is typically defined as the set
{ (x,y) | (x - x0)^2 + (y - y0)^2 = r^2 }
the fragment shader for such a circle looks like this:
fragment() {
ALBEDO = circle(r, x0, y0, P);
}
where P is the current pixel's coordinates
and how, pray tell, is circle defined? well:
color circle(r, x0, y0, P) {
return (x - x0)^2 + (y - y0)^2 == r^2 ? 1 : 0;
}
the standard mathematical definition
and ok, well thats not too shocking, i mean, that IS what a circle is, after all, so why's that so special?
well, it gets worse. or better, depending on if you like math
@beka_valentine could you say what it is about the latter that makes it so?
@boarders im continuing the thread with examples