---
title: 'Buffon’s Needles simulation in Processing'
url: 'https://blog.recursiveprocess.com/2014/03/14/buffons-needles-simulation-in-processing'
markdown: 'https://blog.recursiveprocess.com/2014/03/14/buffons-needles-simulation-in-processing.md'
date: '2014-03-14'
description: "Buffon’s Needle is a famous way to (slowly) estimate . Here’s a processing.org program to calculate (to keep the math-hipster hatred of -day at a critical point and concave up). Link to live simulation and code.\_All variables are easy to change, size of window, length of needle, …"
taxonomy:
  category:
    - blog
---

# Buffon’s Needles simulation in Processing

### [Buffon’s Needles simulation in Processing](https://blog.recursiveprocess.com/2014/03/14/buffons-needles-simulation-in-processing)

   March 14, 2014, 12:00 am  

[Buffon’s Needle](http://en.wikipedia.org/wiki/Buffon's_needle) is a famous way to (slowly) estimate ![\pi](http://s0.wp.com/latex.php?latex=%5Cpi&bg=ffffff&fg=000&s=0&c=20201002).
Here’s a processing.org program to calculate ![\tau](http://s0.wp.com/latex.php?latex=%5Ctau&bg=ffffff&fg=000&s=0&c=20201002) (to keep the math-[hipster](http://tauday.com/) [hatred](https://www.youtube.com/watch?v=5iUh_CSjaSw) of ![\pi](http://s0.wp.com/latex.php?latex=%5Cpi&bg=ffffff&fg=000&s=0&c=20201002)-day at a critical point and concave up).

[ Link to live simulation and code.](http://www.openprocessing.org/sketch/139823) All variables are easy to change, size of window, length of needle, spacing of lines, etc.

[![2014-03-14_12h23_26](https://blog.recursiveprocess.com/wp-content/uploads/2014/03/2014-03-14_12h23_26.png)](https://blog.recursiveprocess.com/wp-content/uploads/2014/03/2014-03-14_12h23_26.png)

Neat program to write. Funnily enough, the code wasn’t working in the javascript version of processing because javascript didn’t understand the constant TAU. Ha.

note: I got the graph idea at the bottom idea from [this sketch](http://www.openprocessing.org/sketch/9297), but I never looked at the actual code.

 [ Next Post](https://blog.recursiveprocess.com/2014/03/19/chaos-game-v2) [Previous Post ](https://blog.recursiveprocess.com/2014/03/05/power-series-on-desmos)

#### SimpleSearch

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

---

## Navigation

- Parent: [A Recursive Process](https://blog.recursiveprocess.com/index.md)
- Previous: [Chaos Game v2](https://blog.recursiveprocess.com/2014/03/19/chaos-game-v2.md)
- Next: [Power Series on Desmos](https://blog.recursiveprocess.com/2014/03/05/power-series-on-desmos.md)
