This is a lab project done under the course CS5016 Computational Methods and Applications. This project illustrates functionality of the Marching Sqaures Algorithm. This algorithm is used to approximate shapes and images, and find contour lines/bands. This algorithm is for 2D use-cases, but for 3D, we have Marching Cubes (with the same basic principle). Instead of Squares, we can have Triangles (called Triangle Meandering) or Tetrahedrons.

The basic principle of this algorithm is as follows:

  1. Assume a grid around the shape (a plane in case of 2D or a cube in case of 3D).
  2. Each grid unit (square/cube/triangle) would have a small subpart of the total shape.
  3. Approximate the subpart with a line according to the pixel/image values corresponding to the unit.
Usually, this process is repeated sequentially for each unit (hence the name 'Marching').

Use Cases of these family of Algorithms:

  1. Approximating Shapes in 2D/3D
  2. Terrain Generation
Real Life Applications:
  1. MRI/CT Scans (To get a visual representation of objects)
  2. Video Games
  3. Product Design

Here are three different applications of the 2D algorithm.

  1. Noisy Screensaver: A noisy data is generated and the algorithm creates a landscape out of it.
  2. Image Contouring: Given an image, get an approximation of the same.
  3. Static Image: A grid of points is randomly colored black/white, and we have to segregate the points (to show the working of the algorithm)