NJIT IT 360 - Marching Squares

Introduction

Marching Squares is an algorithm for generating contour lines or isolines from a two-dimensional scalar field by analyzing grid cells and their corner values. It determines where contours intersect cell edges and connects them to form continuous lines.

It is used in geographic systems and video game procedural world generation, like in Minecraft, to create terrain contours and realistic landscapes.

Explanation

1. Create a square with either 0 or 1 on each of its corners

2. Identify where the square is classified in the look-up table

3. Draw the line of the according index

4. Repeat in a grid

Demo

Presentation

Resources