**Summary**

Approximate ANY path with a single Bezier curve using up to 15K anchors!

I used Tensorflow (machine learning library) to approximate paths with Bezier.

**Usecases**

- Converting any slider to Bezier (without red anchors)

- Increase/decrease the amount of anchors on a Bezier slider

- Generating Bezier sliders with an exact mathematical shape

- Making cursed sliders

**Features**

- Can turn any path into a single Bezier path

- Can input slidercode to convert into a single Bezier path

- Has a library of other mathematical shapes to use

- Retarded feature for retarded anchors that somehow make the desired path

- Easily expandable with some python knowledge

**How to use it**

1. Download and install all the requirements

2. Download this program from the github and unpack the contents into a folder

3. Open slider_approximator.py

4. Input all the arguments (number of anchors~(2-10K), steps~(5K-20K), test resolution~(1K-5K), retardedness~(0-5))

5. Input the slidercode from the .osu

6. Wait a little and see the Bezier anchors move around

7. Find your new slider code in slidercode.txt

1. Open shapes.py and shape_approximator.py with some text editor

2. At the bottom of shape_approximator.py you can find some code showing off how to import a path and use that in the approximator

3. Import any path from shapes.py and make sliders out of it

4. Code your own mathematical shapes and make sliders out of those

- shape_approximator: has the code that does all the Bezier approximation and other stuff

- slider_approximator: user-friendly dialog to use the program using slidercodes

- path_approximator: generates the bezier, catmull, circular arc and liniar paths

- slider_path: calculates slider stuff

- shapes: contains generators for mathematical shapes

- gosper: generates gosper curve fractals

- structs: has some random math

**Requirements**

These are the versions on my computer at the time. Later versions may work too.

- Python 3.5.2 64-bit

and the following modules:

- numpy 1.14.5

- tensorflow 1.10.0 (or tensorflow-gpu)

- matplotlib 2.1.0

- scipy 1.0.0

help

**Download**

https://github.com/OliBomby/Bezier-Approximation

**Known problems**

- Sharp angles can be inconsistently cut off by a few pixels due to how bezier curves only get rendered every 6 pixels

- I used the word 'shape' as if it meant 'path'

**Special thanks to Karoo because without him I would have never started on this program**