Skip to content
This repository has been archived by the owner on Jun 25, 2019. It is now read-only.

Commit

Permalink
Merge pull request #116 from drguildo/magnitude-update
Browse files Browse the repository at this point in the history
Convert uses of PVector.magnitude() to PVector.mag()
  • Loading branch information
shiffman committed Oct 28, 2016
2 parents 7d7aca6 + eec1b19 commit c9c920a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion chapters/02_forces.html
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ <h2>2.8 Air and Fluid Resistance</h2>
<p><span data-type="equation">\rho</span> is the Greek letter <em>rho</em>, 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.</p>
</li>
<li>
<p><span data-type="equation">v</span> 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: <code>velocity.magnitude()</code>. And <span data-type="equation">v^2</span> just means <span data-type="equation">v</span> squared or <span data-type="equation">v \times v</span>.</p>
<p><span data-type="equation">v</span> 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: <code>velocity.mag()</code>. And <span data-type="equation">v^2</span> just means <span data-type="equation">v</span> squared or <span data-type="equation">v \times v</span>.</p>
</li>
<li>
<p><span data-type="equation">A</span> 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.</p>
Expand Down
2 changes: 1 addition & 1 deletion chapters/05_physicslib.html
Original file line number Diff line number Diff line change
Expand Up @@ -2331,7 +2331,7 @@ <h3>Vectors with toxiclibs</h3>
<td>
<pre>
Vec2D a = new Vec2D(1,-1);
float m = a.magnitude();
float m = a.mag();
a.normalize();
</pre>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit c9c920a

Please sign in to comment.