Math library using Swift Numerics

I'm working through Foundations of Game Engine Development vol. 1: Mathematics by Eric Lengyel and decided to try my hand at writing a Swift package based on the material therein. I've been following the exploits of @scanon, first with SIMD types, then Swift Numerics, and wanted to play with these new toys.

You can find the library at FGED.Mathematics.

This is my first attempt at writing such a library, and my first try at protocol-oriented programming. I'd love to hear any feedback from the Swift community about the code, especially WRT protocol-oriented programming and generics. Eric uses some classes to relate vectors and positions, for example, and I wanted to capture that somehow in Swift while modeling everything with value types. Things got a bit tricky when I established the relationships between points, vectors, and matrices, and I'm not sure if I went about things in the right way.

8 Likes
Terms of Service

Privacy Policy

Cookie Policy