# Distance between 2 points

**URL:** <https://discourse.processing.org/t/distance-between-2-points/50187>\
**Category:** Gallery\
**Created:** [November 19, 2026, 4:28pm UTC](https://discourse.processing.org/t/distance-between-2-points/50187 "2026-11-19T16:28:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [November 19, 2026, 4:28pm UTC](https://discourse.processing.org/t/distance-between-2-points/50187/1 "2026-11-19T16:28:38Z")

</div>

Anyone who has written or used path finding algorithms will be familiar with the _ **as-the-crow-flies** _ and _ **Manhattan** _ heuristics for measuring the distance between two points in 2D or 3D space.

What I discovered only recently is that the formulae for both heuristics are specific instances of the Minkowski distance formulae, which in 3D can be written as

\sqrt[p]{\lvert dx\rvert^p +\lvert dy\rvert^p +\lvert dz\rvert^p}

Where \lvert dx\rvert, \lvert dy\rvert and \lvert dz\rvert are the absolute differences between the 2 points along the orthogonal axes.

When p=2 then this equates to the _ **as-the-crow-flies** _ heuristic and when p=1 it equates to the _ **Manhattan** _

This sketch below allows you to experiment by changing the value of p in either 2D or 3D space. The circumference (2D) and the surface (3D) represents all points equidistant (Minkowski distance) from the centre of the shapes.

The sketch code can be found [here](https://editor.p5js.org/quark-js/sketches/dTTqW_CKq)

😃

https://editor.p5js.org/quark-js/full/dTTqW_CKq
