Skip to content
This repository was archived by the owner on May 11, 2025. It is now read-only.

Commit 53773ca

Browse files
author
Yong Bakos
committed
Replacing heading2D with heading for all general examples. Issue #1627
1 parent e55d531 commit 53773ca

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

examples/Topics/Simulate/Flocking/Boid.pde

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class Boid {
7575
// Steering = Desired minus Velocity
7676
steer = target.sub(desired,vel);
7777
steer.limit(maxforce); // Limit to maximum steering force
78-
}
78+
}
7979
else {
8080
steer = new PVector(0,0);
8181
}
@@ -84,7 +84,7 @@ class Boid {
8484

8585
void render() {
8686
// Draw a triangle rotated in the direction of velocity
87-
float theta = vel.heading2D() + PI/2;
87+
float theta = vel.heading() + PI/2;
8888
fill(200,100);
8989
stroke(255);
9090
pushMatrix();

examples/Topics/Simulate/SimpleParticleSystem/Particle.pde

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Particle {
66
PVector acc;
77
float r;
88
float timer;
9-
9+
1010
// Another constructor (the one we are using here)
1111
Particle(PVector l) {
1212
acc = new PVector(0,0.05,0);
@@ -36,7 +36,7 @@ class Particle {
3636
ellipse(loc.x,loc.y,r,r);
3737
displayVector(vel,loc.x,loc.y,10);
3838
}
39-
39+
4040
// Is the particle still useful?
4141
boolean dead() {
4242
if (timer <= 0.0) {
@@ -45,23 +45,23 @@ class Particle {
4545
return false;
4646
}
4747
}
48-
48+
4949
void displayVector(PVector v, float x, float y, float scayl) {
5050
pushMatrix();
5151
float arrowsize = 4;
5252
// Translate to location to render vector
5353
translate(x,y);
5454
stroke(255);
5555
// Call vector heading function to get direction (note that pointing up is a heading of 0) and rotate
56-
rotate(v.heading2D());
56+
rotate(v.heading());
5757
// Calculate length of vector & scale it to be bigger or smaller if necessary
5858
float len = v.mag()*scayl;
5959
// Draw three lines to make an arrow (draw pointing up since we've rotate to the proper direction)
6060
line(0,0,len,0);
6161
line(len,0,len-arrowsize,+arrowsize/2);
6262
line(len,0,len-arrowsize,-arrowsize/2);
6363
popMatrix();
64-
}
64+
}
6565

6666
}
6767

examples/Topics/Simulate/SmokeParticleSystem/SmokeParticleSystem.pde

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
22
* Smoke Particle System
3-
* by Daniel Shiffman.
4-
*
5-
* A basic smoke effect using a particle system.
6-
* Each particle is rendered as an alpha masked image.
3+
* by Daniel Shiffman.
4+
*
5+
* A basic smoke effect using a particle system.
6+
* Each particle is rendered as an alpha masked image.
77
*/
88

99
ParticleSystem ps;
@@ -48,15 +48,15 @@ void draw() {
4848
translate(x,y);
4949
stroke(255);
5050
// Call vector heading function to get direction (note that pointing up is a heading of 0) and rotate
51-
rotate(v.heading2D());
51+
rotate(v.heading());
5252
// Calculate length of vector & scale it to be bigger or smaller if necessary
5353
float len = v.mag()*scayl;
5454
// Draw three lines to make an arrow (draw pointing up since we've rotate to the proper direction)
5555
line(0,0,len,0);
5656
line(len,0,len-arrowsize,+arrowsize/2);
5757
line(len,0,len-arrowsize,-arrowsize/2);
5858
popMatrix();
59-
}
59+
}
6060

6161

6262

0 commit comments

Comments
 (0)