Hardware accelerated visualisation of Modular Multiplication on a Circle written in Swift using Metal API and SwiftUI.
Last updated May 27, 2026
38
Stars
1
Forks
0
Issues
0
Stars/day
Attention Score
13
Language breakdown
Swift 86.6%
Metal 13.4%
▸ Files
click to expand
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 YouTube video by Mathologer_.Written in Swift using Metal API and SwiftUI.
Images
Algorithm
The operating scheme is very simple:- Distribute N points on the circle equally,
- Select a multiplier M
- For each point n:
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 tool.
Once set up, it can create application bundle with proper structure and Metal library included in Core bundle.
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.
🔗 More in this category