Distance and Shape

Sketching with Math and Quasi Physics

Distance function

A shape can be defined by a function that takes the coordinate of a point and returns the distance to the closest boudary of the shape. This function is called distance function and used as a modeling technique in computer graphics.

Learn more

Ray Marching and Signed Distance Functions by Jamie Wong

The book of shaders - Shaping function by Patricio Gonzalez Vivo & Jen Lowe

Distance functions by Inigo Quilez


The size of dots indicate the distance from the boundary of the shape (the smaller the closer). White dots are inside the shape. Black dots are outside.


Rotated rectangle

See also

Rotating 2D points