Source: http://acg.cs.tau.ac.il/courses/algorithmic-robotics/spring-2011/gp.pdf