/* Initialisation */
int stepsA = 12;
int stepsB = 12;
int stepsX = 12;
int stepsY = 12;
void setup ()
{
size(600, 500, P3D);
smooth();
frameRate(30);
}
void draw() {
//ortho();
lights();
background(#D6D6D6);
camera(400, -400, 400, // eyeX, eyeY, eyeZ
0, 0, 0.0, // centerX, centerY, centerZ
0.0, 1.0, 0.0); // upX, upY, upZ
float dirY = (mouseY / float(height) - 0.5) * 2;
float dirX = (mouseX / float(width) - 0.5) * 2;
directionalLight(204, 204, 204, -dirX, -dirY, -1);
ambientLight(0,0,0,204,204,204);
// Draw the axes
noStroke();
pushMatrix();
translate(300/2,0,0);
box(350, 0, 350);
popMatrix();
pushMatrix();
translate(0,-300/2,0);
box(0, 350, 350);
popMatrix();
// Draw the Grid
stroke(#000000);
strokeWeight(0.5);
for(int y=-325;y<-2;y=y+stepsY){
line(2,y,176,2,y,-172);
}
for(int x=1;x<326;x=x+stepsX){
line(x,-2,176,x,-2,-172);
}
for(int a=-172;a<177;a=a+stepsA){
line(2,-2,a,2,-325,a);
}
for(int b=-172;b<177;b=b+stepsB){
line(325,-2,b,2,-2,b);
}
noStroke();
pushMatrix();
translate(40, -250, -300);
popMatrix();
pushMatrix();
translate(340, -140, 240);
popMatrix();
// Draw a line
stroke(#000000);
strokeWeight(1);
line(340,-140,240,40,-250,-300);
noStroke();
pushMatrix();
translate(40, -250, -300);
sphere(5);
popMatrix();
pushMatrix();
translate(340, -140, 240);
sphere(5);
popMatrix();
}