Math Animation of Pythagoras

Thought I’d share this here as it was made with Codea. It’s an animation of a proof of Pythagoras’ theorem, submitted for the “Talk Math[s] in Public” animation challenge for May.

1 Like

how did you make the angle arcs?

They’re a shader.

The mesh is just a square, the work is done in the fragment part. I specify a unit vector, say (x,y), which represents the point on the unit circle where the arc goes to. Then for a point in the square I first transform it to be relative to the centre of the square and then colour it if it is between the x-axis and the vector. Specifically, if (u,v) are the transformed coordinates then to colour that pixel I require:

u²+v²<=1 and u/(u²+v²) >= x but then I actually rearrange the latter to u >= x(u²+v²) to avoid division by 0.