Giter VIP home page Giter VIP logo

unity.mathematics.fixedpoint's Introduction

Original work

This project is a fork of Daniel Månssons original implementation found here

Unity.Mathematics.FixedPoint

A Fixed-point extension of Unity's C# math library based on FixedMath.Net and Unity.Mathematics. One of the main reasons for using this library instead of the built-in one is support for cross-platform determinism, until Unity officially supports it with Burst/DOTS.

The intention is to keep the API as close as possible to Unity.Mathematics. This should make it easy to convert your project to use floating point math if needed.

Usage

You can use this library in your Unity game by adding this repository to the package manifest file in your Unity project. PROJECT_ROOT/Packages/manifest.json:

{
  "dependencies": {
    "com.crgab.mathematics.fixedpoint": "https://github.com/CRG-AB/Unity.Mathematics.FixedPoint.git"
  }
}

Testing and developing

The easiest way to iterate on this package is to clone this repository and the test project side-by-side and open the test project in Unity. This resolves the required dependencies (Unity.Mathematics) and makes the test runner available.

Example project

A simple example project can be found here. It contains two side-by-side simulations, one using a floating point implementation and the other using fixed point.

Missing features

Unity.Mathematics.FixedPoint is not feature complete yet. This is missing:

  • quaternion
  • fpmath.tanh
  • fpmath.cosh
  • fpmath.sinh
  • fpmath.exp
  • fpmath.log10

Method stubs are added to match the API, but they are marked as obsolete with a compile error.

Maintaining changes from Unity.Mathematics

Unity.Mathematics is using code generation to create their vector and matrix types. Most of the changes in this repository from Unity.Mathematics has been in VectorGenerator.cs and fpmath.cs.

The plan is to keep this repository almost up to date with Unity.Mathematics, so changes has been isolated as much as possible. However, VectorGenerator.cs was not made with external extensibility in mind. When there are internal changes to Unity.Mathematics in upcoming versions, this will require manual patching.

fpmath.cs contains the common fixed point math operations. The implementations are based on the floating point methods in Unity.Mathematics math.cs.

Precision

More tests are needed to verify the precision of all fixed point operations. There might be intermediate calculations unsuitable for fixed point in the current implementation.

Licensing

This project is licensed under the MIT License (LICENSE.md)

Unity.Mathematics (Unity Companion License)

FixedMath.Net (Apache License, Version 2.0)

unity.mathematics.fixedpoint's People

Contributors

danielmansson avatar crg-hans avatar crg-viktor 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.