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

https://github.com/alordash/newton-fractal

Drawing Newton's fractal using pure js, rust-wasm, SIMDs, threads and GPU
https://github.com/alordash/newton-fractal

glsl newton-fractal newton-fractals newton-method newtons-fractal rust simd threads wasm web-worker webgl webgl2

Last synced: 2 months ago
JSON representation

Drawing Newton's fractal using pure js, rust-wasm, SIMDs, threads and GPU

Awesome Lists containing this project

README

        

# Newton's fractal

Runtime [Newton's fractal](https://en.wikipedia.org/wiki/Newton_fractal) renderer.

### [>>Click<<](https://alordash.github.io/newton-fractal/www/index.html) to open in your browser

Inspired by [3blue1brown](https://www.3blue1brown.com/)'s [video about Newton's fractal](https://youtu.be/-RdOwhmqP5s).

![Demo preview](./demo/11-250.png)

## Build

1. Rust-wasm:
`wasm-pack build --target web`
2. TypeScript:
`tsc`

## Drawing techniques

### 1. Javascript [fractal_calculation.ts](https://github.com/alordash/newton-fractal/blob/main/scripts/math/fractal_calculation.ts) and [geometry.ts](https://github.com/alordash/newton-fractal/blob/main/scripts/math/geometry.ts)

### 2. **Rust-WASM**: scalar [fractal_calculation.rs](https://github.com/alordash/newton-fractal/blob/main/src/fractal_calculation.rs) and [geometry.rs](https://github.com/alordash/newton-fractal/blob/main/src/geometry.rs)

### 3. **Rust-WASM**: [SIMD](https://en.wikipedia.org/wiki/Single_instruction,_multiple_data) commands [fractal_calculation.rs](https://github.com/alordash/newton-fractal/blob/main/src/fractal_calculation.rs) and [simd_math.rs](https://github.com/alordash/newton-fractal/blob/main/src/simd_math.rs) (includes comments)

### 4. **GPU glsl**sources: [webgl2_drawing.ts](https://github.com/alordash/newton-fractal/blob/main/scripts/webgl/webgl2_drawing.ts) and [gl_manager.ts](https://github.com/alordash/newton-fractal/blob/main/scripts/webgl/gl_manager.ts)
shaders: [vertex.vert](https://github.com/alordash/newton-fractal/blob/main/webgl/vertex.vert) and [fragment.frag](https://github.com/alordash/newton-fractal/blob/main/webgl/fragment.frag)

### 5. **Multithreading** for 1-3 techniques[drawing_manager.ts](https://github.com/alordash/newton-fractal/blob/main/scripts/drawing/drawing_manager.ts) and [drawing_worker.ts](https://github.com/alordash/newton-fractal/blob/main/scripts/drawing/drawing_worker.ts)