# grid.py

# Draw a grid
def grid():
    x1, x2, dx = -100.0, 100.0, 10.0
    y1, y2, dy = -100.0, 100.0, 10.0

    # Draw grid
    stroke(225,225,255)

    x = x1
    while x <= x2:
        line(x,y1,x,y2)
        x+=dx
    y = y1
    while y <= y2:
        line(x1,y,x2,y)
        y+=dy

    # Draw axes
    inc = 0.005*width()
    inc2 = 2.0*inc
    stroke(0)
    fill(0)
    line(x1,0,x2,0)
    triangle(x2+inc2,0,x2,inc,x2,-inc)
    text("x",x2+2*inc2,inc2)
    line(0,y1,0,y2)
    triangle(0,y2+inc2,inc,y2,-inc,y2)
    text("y",inc2,y2+2*inc2)

from Processing import *
window(500, 500)

background(255)

translate(250.0, 250.0)
rotate( radians(25) )
scale( 2 )

grid()
