Skip to content

Instantly share code, notes, and snippets.

final int SIZE = 120;
float angle = 0;
float maxAngle = 0.2;
float dAngle = 0.001;
void setup() {
size(600, 600);
rectMode(CENTER);
stroke(0);
@sbalev
sbalev / int_trigo.md
Last active April 11, 2018 12:51
Introducing integer trigonometric functions

Integer trigonometry

Suppose we want to implement a robot moving on integer grid. Usually my code looks like this:

class Robot {
  int x, y;
  int heading; // 0 = East, 1 = North, 2 = West, 3 = South

  void turnLeft() {