removed Normalize duplicate example

This commit is contained in:
shiffman
2013-01-04 20:15:50 +00:00
parent 8f6530c080
commit 09a6f21634

View File

@@ -1,37 +0,0 @@
/**
* Normalize
* by Daniel Shiffman.
*
* Demonstration of normalizing a vector.
* Normalizing a vector sets its length to 1.
*/
void setup() {
size(640,360);
smooth();
}
void draw() {
background(0);
// A vector that points to the mouse location
PVector mouse = new PVector(mouseX,mouseY);
// A vector that points to the center of the window
PVector center = new PVector(width/2,height/2);
// Subtract center from mouse which results in a vector that points from center to mouse
mouse.sub(center);
// Normalize the vector
mouse.normalize();
// Multiply its length by 50
mouse.mult(150);
translate(width/2,height/2);
// Draw the resulting vector
stroke(255);
line(0,0,mouse.x,mouse.y);
}