---
title: '3d Representation of Dog Chase'
url: 'https://blog.recursiveprocess.com/2015/11/13/3d-representation-of-dog-chase'
markdown: 'https://blog.recursiveprocess.com/2015/11/13/3d-representation-of-dog-chase.md'
date: '2015-11-13'
description: 'Not what it sounds like. The four dog problem from Steve Strogatz: N dogs start in the corners of a regular N-gon. Each runs directly toward the dog on its left. How far do they run before colliding? — Steven Strogatz (@stevenstrogatz) October 27, 2015 Here is how it was used in my class. …'
taxonomy:
  category:
    - blog
---

# 3d Representation of Dog Chase

### [3d Representation of Dog Chase](https://blog.recursiveprocess.com/2015/11/13/3d-representation-of-dog-chase)

   November 13, 2015, 12:00 am  

Not what it sounds like.
The four dog problem from [Steve Strogatz](https://twitter.com/stevenstrogatz/):

> N dogs start in the corners of a regular N-gon. Each runs directly toward the dog on its left. How far do they run before colliding?
> 
> — Steven Strogatz (@stevenstrogatz) [October 27, 2015](https://twitter.com/stevenstrogatz/status/658980873077936128?ref_src=twsrc%5Etfw)

[Here is how it was used in my class](http://photo180.recursiveprocess.com/?p=2348).

## Halfway Dogs

If the dogs blindly travel half way towards the next dog before re-aiming, then you get this picture, where each vertex represents the dog’s position:
[![2015-11-13_14h30_36](https://blog.recursiveprocess.com/wp-content/uploads/2015/11/2015-11-13_14h30_36.png)](https://blog.recursiveprocess.com/wp-content/uploads/2015/11/2015-11-13_14h30_36.png)
If you raise each square up in the z-dimension and print the resulting 3d shape then you can get this:
[![FullSizeRender](https://blog.recursiveprocess.com/wp-content/uploads/2015/11/FullSizeRender-1024x820.jpg)](https://blog.recursiveprocess.com/wp-content/uploads/2015/11/FullSizeRender.jpg)

## 12% Dogs

If the dogs travel 12% of the way before re-aiming then you get this picture, and this 3d shape:

[![2015-11-13_14h30_20](https://blog.recursiveprocess.com/wp-content/uploads/2015/11/2015-11-13_14h30_20.png)](https://blog.recursiveprocess.com/wp-content/uploads/2015/11/2015-11-13_14h30_20.png)

[![IMG_2116](https://blog.recursiveprocess.com/wp-content/uploads/2015/11/IMG_2116-1024x768.jpg)](https://blog.recursiveprocess.com/wp-content/uploads/2015/11/IMG_2116.jpg)

## Interactive 2d Version

The generalized interactive 2d version of this concept is a lot of fun to play with. [In this demo](http://openprocessing.org/sketch/200103), your mouse horizontal controls how much to spin each square, and your mouse vertical controls how much to scale each square. [Matt Enlow](https://twitter.com/CmonMattTHINK/status/601554029559218176) was the driving force behind this super fun demo. Some samples:

[![2015-11-13_14h49_43](https://blog.recursiveprocess.com/wp-content/uploads/2015/11/2015-11-13_14h49_43.png)](https://blog.recursiveprocess.com/wp-content/uploads/2015/11/2015-11-13_14h49_43.png) [![2015-11-13_14h50_01](https://blog.recursiveprocess.com/wp-content/uploads/2015/11/2015-11-13_14h50_01.png)](https://blog.recursiveprocess.com/wp-content/uploads/2015/11/2015-11-13_14h50_01.png) [![2015-11-13_14h52_05](https://blog.recursiveprocess.com/wp-content/uploads/2015/11/2015-11-13_14h52_05.png)](https://blog.recursiveprocess.com/wp-content/uploads/2015/11/2015-11-13_14h52_05.png)

## Code

Here’s the code for both of these shapes in madeup:

### Halfway dogs:

```
thickness = 3
size = 10.0
theta = 0
z = 0
repeat 15
  t = 0
  while t <= 360
    x = size * cos (t + theta)
    y = size * sin (t + theta)
    t = t + 90
    moveto x,y,z
  end
  extrude 0,0,1,thickness
  theta = theta + 45
  thickness = thickness * (0.5)^0.5
  z = z + thickness
  size = size * (0.5)^0.5
end
```

### 12% dogs:

```
thickness = 1
size = 10.0
theta = 0
z = 0
repeat 35
  t = 0
  while t <= 360
    x = size * cos (t + theta)
    y = size * sin (t + theta)
    t = t + 90
    moveto x,y,z
  end
  extrude 0,0,1,thickness
  theta = theta + 8.775
  thickness = thickness * 0.84
  z = z + thickness
  size = size * 0.8775
end
```

 [ Next Post](https://blog.recursiveprocess.com/2016/02/14/the-mango-gates-puzzler) [Previous Post ](https://blog.recursiveprocess.com/2015/11/09/the-last-seat-car-talk-puzzler)

#### SimpleSearch

Bootstrap Theme for [Grav](http://getgrav.org)

---

## Navigation

- Parent: [A Recursive Process](https://blog.recursiveprocess.com/index.md)
- Previous: [The Mango Gates – Puzzler](https://blog.recursiveprocess.com/2016/02/14/the-mango-gates-puzzler.md)
- Next: [The Last Seat : Car Talk Puzzler](https://blog.recursiveprocess.com/2015/11/09/the-last-seat-car-talk-puzzler.md)
