Coder Social home page Coder Social logo

abacus's Introduction

Abacus

Build Status License Nuget Version Nuget Downloads

Overview

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.

Supported types

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)

Getting started

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.

Example usage

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);
    }
}

Details

    +Y
     |
     |
     |______ +X     * X: right
    /               * Y: up
   /                * Z: backwards
 +Z
  • Abacus uses a right handed coordinate system.
  • Angles of rotation are measured anti-clockwise when viewed from the rotation axis (positive side) toward the origin. Right handed rule for rotations - thumb pointing along the axis of rotation, away from the origin.
  • Cameras are aligned with the main coordinate system and look in the direction of their negative Z axis (just like OpenGL).
  • Near and far planes are defined by their Z positions in view-space, not as their distance from the camera in view space. This means they will be negative in the general case.
  • Normalised device coordinates are inline with the main coordinate system and range from -1 to 1 on all axes.
  • Abacus has been built using T4 text templatization as there is limited support for expressing generic type constraints in C#.
  • Fixed point Q numbers in Abacus can be easily customised by adjusting the code generation logic.

Contributing

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.

License

Abacus is licensed under the MIT License; you may not use this software except in compliance with the License.

abacus's People

Contributors

sungiant avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.