controlling the length of line from x,y to a point which is randomly chosen
in
Programming Questions
•
1 month ago
I want to keep drawing lines from the last point to the next point -- the next point is randomly chosen (Brownian movement) but I woud like to be able to control the length of the line, say have each line be 80 points long. I'm no math prodigy and I can't seem to find the right functions to look at. Here's the functioning code:
I want the set the distance of the line which is drawn from x,y to ex, ey.
You can see the line drawing in operation here:
http://www.borderlinegeek.com/big-data.htm
Thanks much for any help.
- point (x, y);
- fill(255,0,0); // make a red circle around each node
- ellipse(x,y, 8,8);
- ex = int(random(0, rangex));
- ey = int(random(0, rangey));
- stroke(4,216,52); // green line
- line(x, y, ex, ey);
I want the set the distance of the line which is drawn from x,y to ex, ey.
You can see the line drawing in operation here:
http://www.borderlinegeek.com/big-data.htm
Thanks much for any help.
1