# shiffman/The-Nature-of-Code

Merge pull request #116 from drguildo/magnitude-update

Convert uses of PVector.magnitude() to PVector.mag()
2 parents 7d7aca6 + eec1b19 commit c9c920a2789714d8d5f6cd571e4be031cd5a1a53 committed on GitHub Oct 28, 2016
 @@ -769,7 +769,7 @@

\rho is the Greek letter rho, and refers to the density of the liquid, something we don’t need to worry about. We can simplify the problem and consider this to have a constant value of 1.

• -

v refers to the speed of the object moving. OK, we’ve got this one! The object’s speed is the magnitude of the velocity vector: velocity.magnitude(). And v^2 just means v squared or v \times v.

+

v refers to the speed of the object moving. OK, we’ve got this one! The object’s speed is the magnitude of the velocity vector: velocity.mag(). And v^2 just means v squared or v \times v.

• A refers to the frontal area of the object that is pushing through the liquid (or gas). An aerodynamic Lamborghini, for example, will experience less air resistance than a boxy Volvo. Nevertheless, for a basic simulation, we can consider our object to be spherical and ignore this element.

•  @@ -2331,7 +2331,7 @@
Vec2D a = new Vec2D(1,-1);
-float m = a.magnitude();
+float m = a.mag();
a.normalize();

 @@ -78,7 +78,7 @@ class Particle{ // if the particle is moving fast enough, when it hits the ground it can // split into a bunch of smaller particles. if( ISBOUNCING ){ - bounceVel = vel.magnitude(); + bounceVel = vel.mag(); vel.scaleSelf( .7 ); vel.y *= -( ( radius/40.0 ) * .5 );
 @@ -78,7 +78,7 @@ class Particle{ // if the particle is moving fast enough, when it hits the ground it can // split into a bunch of smaller particles. if( ISBOUNCING ){ - bounceVel = vel.magnitude(); + bounceVel = vel.mag(); vel.scaleSelf( .7 ); vel.y *= -( ( radius/40.0 ) * .5 );