https://github.com/thajiyev/fractal
Sierpiński triangle formed one point at a time
https://github.com/thajiyev/fractal
pascal-triangle pascal-triangle-generator
Last synced: 3 months ago
JSON representation
Sierpiński triangle formed one point at a time
- Host: GitHub
- URL: https://github.com/thajiyev/fractal
- Owner: THajiyev
- License: mit
- Created: 2023-01-09T20:32:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-13T07:27:35.000Z (over 2 years ago)
- Last Synced: 2024-12-30T20:20:13.239Z (5 months ago)
- Topics: pascal-triangle, pascal-triangle-generator
- Language: JavaScript
- Homepage: https://thajiyev.github.io/fractal/
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sierpinski Triangle Simulator
## How does it work?
During each iteration, we plot the midpoint between the previous point(starting with the apex) and a randomly chosen vertex.
## Example
This is a simplified example of this process with a non-equilateral triangle in the first quadrant.
Let's say it has a width and a height of 16 units.
```mermaid
graph TB
A[Vertices] --> B[(0,0)]
A[Vertices] --> C[(16,0)]
A[Vertices] --> D[(8, 16)]
E[Apex] --> D[(8, 16)]
```
The first point is the apex.
Last Point | Chosen vertex | Mid-point
--- | --- | ---
(8,16) | (0,0) | (4,8)
(4,8) | (16,0) | (10,4)
(10,4) | (8,16) | (9,10)As we add more points using this process, a Sierpinski Triangle forms.