-
Notifications
You must be signed in to change notification settings - Fork 0
Math library
In Sakura we have our own implementation of the math library.
In this project's dependency, we have 2 math library that we based on
For the performance, the System.Numerics has done a better job based on the Hardware Intrinsics type support so I decided to create our own implementation based on these 2 libraries since we can't throw the Silk.NET's math library of due to all binding in Silk.NET required the type from this library.
Another reason is from this discussion
The math class reside in Sakura.Framework.Maths namespace. In each struct the structure is the same
- Original
System.Numericstype to store the real value (We call thisValuein the code) - Basic value binding to the real value (e.g.
Vector2haveXandY) -
Implicit type conversion between
Sakura.Framework.Maths,System.NumericsandSilk.NET.Maths
Note that all of the struct marked as partial and have MathStruct attribute for the source generator that will generate the method used in that class based on the method in System.Numerics.
See Source Generator > Math struct for more info on the source generator.