:triangular_ruler: C# cross precision 3D maths library.
Abacus is a zero-dependency cross-precision 3D maths library for .NET, Mono and .NET Core. Abacus provides implementations for 32 bit and 64 bit fixed point Q numbers and provides common 3D maths types consistently across both fixed and floating point precisions.
The rationale around building Abacus is rooted in the development of deterministic game simulations.
Documentation for Abacus can be found here.
Abacus provides implementations of the following common 3D maths data types:
Vector2
Vector3
Vector4
Matrix44
Quaternion
consistently across the following precisions:
Single
(float
)Double
(double
)Fixed32
(Q16.16
)Fixed64
(Q40.24
)Abacus is available as a stand-alone library via nuget.
Alternatively, all code associated with each supported level of precision is generated into a single C# source file - this makes it easy to simply copy the appropriate Abacus.###.cs file.
Abacus makes it easy to switch/test the precision used by a block of code as the API is consitent across all supported precisions - simply use the appropriate namespace:
//using Abacus.SinglePrecision;
//using Abacus.DoublePrecision;
using Abacus.Fixed32Precision; // selected precision
//using Abacus.Fixed64Precision;
class Program {
public static void Main (string[] args) {
var a = new Vector2 (-100, +50);
var b = new Vector2 (+90, -70);
var c = new Vector2 (-20, +5);
var d = new Vector2 (+30, -5);
Vector2 result = Vector2.CatmullRom (a, b, c, d, 0.4);
}
}
+Y
|
|
|______ +X * X: right
/ * Y: up
/ * Z: backwards
+Z
If you find a bug or have an issue please reach out via the GitHub Issue tracking system. Feel feel to submit PR with improvements.
Abacus is licensed under the MIT License; you may not use this software except in compliance with the License.