Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eshirazi/marching-squares
A simple and intuitive take on the Marching Squares algorithm
https://github.com/eshirazi/marching-squares
Last synced: 1 day ago
JSON representation
A simple and intuitive take on the Marching Squares algorithm
- Host: GitHub
- URL: https://github.com/eshirazi/marching-squares
- Owner: eshirazi
- Created: 2019-08-02T21:49:33.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-01-27T16:06:29.000Z (almost 3 years ago)
- Last Synced: 2023-08-13T07:33:55.409Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 224 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# marching-squares
A simple and intuitive take on the Marching Squares algorithm.Written using [three.js](https://threejs.org/).
## Demo
[Check out the Live Demo](https://eshirazi.github.io/marching-squares/)## An intuative take on the Marching Squares algorithm
We're using a more intuitive and easier to implement approach to the Marching Squares algorithm.The [Marching Squares algorithm](https://en.wikipedia.org/wiki/Marching_squares) is used to render an apporiximation of the isoline of a function over the 2D plane.
A typical implementation scans the function in non overlapping square intervals over the x and y axes.
For each square it then handles 16 pre coded cases, in order to find a line with a good approximation for F's isoline withing each square.In our implementation, we approximate F's isoline by visualaizing F as a 3D map of created from triangles.
To approximate F's boundary, we simply slice it, triangle by triangle, with a plane parallel to the X-Y plane.## Key Files:
- F.js - defines a mathematical function creating a nice metaball like effect
- functionAltitudeRenderer.js - renders the function's values on the 2d plane with grayscale colors
- marchingSquaresRenderer.js - renders F's boundary by using the Marching Squares variation described above.