The most useful math formulas

submited by
Style Pass
2021-06-10 20:00:44

These last years, in the context of working on a graphic rendering engine, I've been confronted to many engineering problems involving mathematics: basic geometry, colorimetry, curves, animations, video, etc. In all these situations, I needed at some point to formalize a "space conversion" of some sort.

My mathematical background is extremely fragile, but coming up with some very basic tooling for these operations helped me building up my mental models so much faster. These formulas were by far the most impactful in my daily struggle with maths.

Anytime you try to abstract a concept mathematically, you're usually working within the [0;1] range, the "purest" data form representation. This is often referred as the "normalized form". When we have a value in this range, we can map it to any range using a mix() function, also known as lerp():

The first one is numerically stable, meaning that's the form we usually want to use in the code, because it will lead to less floating point inaccuracies.

Leave a Comment