Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ovpavlov/unit-generator


https://github.com/ovpavlov/unit-generator

dimensional-analysis math mathematics metric-system physics units units-of-measurement unity unity3d

Last synced: 28 days ago
JSON representation

Awesome Lists containing this project

README

        

# Unit Generator

Generates physics metric units, and performs compile time dimensional analysis

## Compile time dimensional analysis:

Now you don't need to worry about messing up your physics equations

How it works:

you configure the generator and it generates all the units and operations with dimensional analysis already done.
```cs
public static N operator /(W power, mps speed) => new N(power.f / speed.f);
```

## Bonus feature - Units in your editor:

Don't worry all the conversions happen in editor.

You can configure whatewer units you want in your editor.

Supports All the physics units: s, kg, m, A, K, mol, cd;

Bonus unit: rad for more efficien conversion from deg to rad in editor.

## How to use:
1. Create UnitGenerator ScriptableObject in a directory where you want to generate the units code.
1. Alternatively you can Copy Packages/com.ovpavlov.unitgenerator/Editor/UnitGeneratorExample.asset for preconfigured generator example
2. Toggle 'Dry Run' and then press 'Generate Button'(which in fact is a Button that looks like a toggle), and check Console to see diagnostics.
3. Untoggle 'Dry Run' and then press 'Generate Button' to generate the code