Fun with linear algebra


Let's have some fun with math, especially linear algebra!

- Is this your idea of fun, Erik?

- Yes, when you see what you've learned is actually working in real life, then that's fun. Not fun as in drinking whiskey, but you get the idea...

When I studied linear algebra in school I had no idea when I would need to know if two vectors are pointing in the same direction or why you would ever need to use the cross product. But a few years later, I've found some practical problems to solve where I actually needed to know if two vectors are pointing in the same direction. I've collected these problems and their mathematical solutions in a new tutorial series: Use Linear Algebra to solve problems in Unity with C#.

The problems I've solved so far are:

The idea is to minimize the text and instead have finished code with comments that you can just copy and paste. Some of these problems you have solve in a rush. When I competed in the Ludum Dare competition, where the idea is to make a game in 48 hours, I needed to know if two line segments are intersecting with each other. But I couldn't solve the problem fast enough so I had to come up with another idea, which took some extra time and thus made the final game worse.



Comments