Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gracien-app/modularmtl
Hardware accelerated visualisation of Modular Multiplication on a Circle written in Swift using Metal API and SwiftUI.
https://github.com/gracien-app/modularmtl
apple-metal metal metal-api swift swiftui visualization
Last synced: 25 days ago
JSON representation
Hardware accelerated visualisation of Modular Multiplication on a Circle written in Swift using Metal API and SwiftUI.
- Host: GitHub
- URL: https://github.com/gracien-app/modularmtl
- Owner: gracien-app
- Created: 2022-02-14T02:16:17.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-10T23:27:05.000Z (over 2 years ago)
- Last Synced: 2023-03-03T23:17:22.818Z (almost 2 years ago)
- Topics: apple-metal, metal, metal-api, swift, swiftui, visualization
- Language: Swift
- Homepage:
- Size: 8.65 MB
- Stars: 13
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ModularMTL
## About
Modular multiplication on a circle, is a beautiful way to visualise interesting patterns, emerging from basic operation of multiplication. The inspiration for this visualization came from [Times Tables, Mandelbrot and the Heart of Mathematics](https://youtu.be/qhbuKbxJsk8) YouTube video by _Mathologer_.Written in **Swift** using **Metal API** and **SwiftUI**.
## Images
![Prototype](Images/Preview.png)## Algorithm
The operating scheme is very simple:
- Distribute _**N**_ points on the circle equally,
- Select a multiplier _**M**_
- For each point **_n_**:
- Perform modulo _**N**_ operation on a product of index of point _**n**_ and multiplier _**M**_
- The result of the above operation becomes the index of the endpoint _**e**_
- Create a connection between points _**n**_ and _**e**_Computation of connections is offloaded to Compute Shaders, written using Metal Shading Language.
## Features
- Animation mode,
- Parameter controls using arrow keys,
- Glow effect on supported hardware (Metal Performance Shaders),
- Managed using Swift Package Manager with separate _Core_ module.## Building
Binary must be bundled together with Core bundle containing default Metal library (`.metallib` file).
The easiest way to do that, is using [swift-bundler](https://github.com/stackotter/swift-bundler) tool.Once set up, it can create application bundle with proper structure and Metal library included in Core bundle.
```sh
git clone https://github.com/gracien-app/ModularMTL.git
cd ModularMTL# Build Universal binary in Release configuration.
# Application bundle will be created in your current directory.
swift-bundler build -c release -o . -u
```*Universal application bundle available in releases.*