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

Commit

Permalink
remove   from figcaption #63
Browse files Browse the repository at this point in the history
  • Loading branch information
shiffman committed Apr 20, 2016
1 parent dd2b59a commit 69a1706
Show file tree
Hide file tree
Showing 11 changed files with 150 additions and 150 deletions.
20 changes: 10 additions & 10 deletions chapters/01_vectors.html
Expand Up @@ -147,7 +147,7 @@ <h2>1.2 Vectors for Processing Programmers</h2>
<p>Here are some vectors and possible translations:</p>

<figure id="chapter01_figure2"><img alt="Figure 1.2" src="chapter01/ch01_02.png" />
<figcaption>Figure 1.2&nbsp;</figcaption>
<figcaption>Figure 1.2</figcaption>
</figure>

<div data-type="note">
Expand All @@ -170,7 +170,7 @@ <h2>1.2 Vectors for Processing Programmers</h2>
<p>You&rsquo;ve probably done this before when programming motion. For every frame of animation (i.e. a single cycle through Processing&rsquo;s <span class="function">draw()</span> loop), you instruct each object on the screen to move a certain number of pixels horizontally and a certain number of pixels vertically.</p>

<figure id="chapter01_figure3"><img alt="Figure 1.3" src="chapter01/ch01_03.png" />
<figcaption>Figure 1.3&nbsp;</figcaption>
<figcaption>Figure 1.3</figcaption>
</figure>

<p>For every frame:</p>
Expand All @@ -184,7 +184,7 @@ <h2>1.2 Vectors for Processing Programmers</h2>
<p>Nevertheless, another way to describe a location is the path taken from the origin to reach that location. Hence, a location can be the vector representing the difference between location and origin.</p>

<figure id="chapter01_figure4"><img alt="Figure 1.4" src="chapter01/ch01_04.png" />
<figcaption>Figure 1.4&nbsp;</figcaption>
<figcaption>Figure 1.4</figcaption>
</figure>

<p>Let&rsquo;s examine the underlying data for both location and velocity. In the bouncing ball example, we had the following:</p>
Expand Down Expand Up @@ -277,13 +277,13 @@ <h2>1.3 Vector Addition</h2>
<p>Let&rsquo;s say I have the following two vectors:</p>

<figure id="chapter01_figure5"><img alt="Figure 1.5" src="chapter01/ch01_05.png" />
<figcaption>Figure 1.5&nbsp;</figcaption>
<figcaption>Figure 1.5</figcaption>
</figure>

<p>Each vector has two components, an <span class="var">x</span> and a <span class="var">y</span>. To add two vectors together, we simply add both <span class="var">x</span><code>&rsquo;</code>s and both <span class="var">y</span><code>&rsquo;</code>s.</p>

<figure id="chapter01_figure6"><img alt="Figure 1.6" src="chapter01/ch01_06.png" />
<figcaption>Figure 1.6&nbsp;</figcaption>
<figcaption>Figure 1.6</figcaption>
</figure>

<p>In other words:</p>
Expand Down Expand Up @@ -621,7 +621,7 @@ <h2>Vector multiplication</h2>
}</pre>

<figure class="half-width-right" id="chapter01_figure9"><img alt="Figure 1.9" src="chapter01/ch01_09.png" />
<figcaption>Figure 1.9&nbsp;</figcaption>
<figcaption>Figure 1.9</figcaption>
</figure>

<a data-primary="div() function (PVector class)" data-type="indexterm"></a> <a data-primary="PVector class (Processing)" data-secondary="div() function" data-type="indexterm"></a>
Expand Down Expand Up @@ -725,7 +725,7 @@ <h2>1.6 Normalizing Vectors</h2>
<p>Calculating the magnitude of a vector is only the beginning. The magnitude function opens the door to many possibilities, the first of which is <strong><em>normalization</em></strong>. Normalizing refers to the process of making something &ldquo;standard&rdquo; or, well, &ldquo;normal.&rdquo; In the case of vectors, let&rsquo;s assume for the moment that a standard vector has a length of 1. To normalize a vector, therefore, is to take a vector of any length and, keeping it pointing in the same direction, change its length to 1, turning it into what is called a <strong><em>unit vector</em></strong>.</p>

<figure class="half-width-right" id="chapter01_figure12"><img alt="Figure 1.12" src="chapter01/ch01_12.png" />
<figcaption>Figure 1.12&nbsp;</figcaption>
<figcaption>Figure 1.12</figcaption>
</figure>

<p>Since it describes a vector&rsquo;s direction without regard to its length, it&rsquo;s useful to have the unit vector readily accessible. We&rsquo;ll see this come in handy once we start to work with forces in Chapter 2.</p>
Expand All @@ -739,7 +739,7 @@ <h2>1.6 Normalizing Vectors</h2>
<a data-primary="normalize() function (PVector class)" data-type="indexterm"></a> <a data-primary="PVector class (Processing)" data-secondary="normalize() function" data-type="indexterm"></a>

<figure class="half-width-right" id="chapter01_figure13"><img alt="Figure 1.13" src="chapter01/ch01_13.png" />
<figcaption>Figure 1.13&nbsp;</figcaption>
<figcaption>Figure 1.13</figcaption>
</figure>

<p>In the <span class="klass">PVector</span> class, we therefore write our normalization function as follows:</p>
Expand Down Expand Up @@ -1298,15 +1298,15 @@ <h2>1.10 Interactivity with Acceleration</h2>
<a data-primary="acceleration algorithms" data-secondary="interactive" data-type="indexterm"></a>

<figure class="half-width-right" id="chapter01_figure14"><img alt="Figure 1.14" src="chapter01/ch01_14.png" />
<figcaption>Figure 1.14&nbsp;</figcaption>
<figcaption>Figure 1.14</figcaption>
</figure>

<p>To finish out this chapter, let&rsquo;s try something a bit more complex and a great deal more useful. We&rsquo;ll dynamically calculate an object&rsquo;s acceleration according to a rule stated in Algorithm #3 &mdash; <em>the object accelerates towards the mouse</em>.</p>

<p>Anytime we want to calculate a vector based on a rule or a formula, we need to compute two things: <strong><em>magnitude</em></strong> and <strong><em>direction</em></strong>. Let&rsquo;s start with direction. We know the acceleration vector should point from the object&rsquo;s location towards the mouse location. Let&rsquo;s say the object is located at the point (<span class="var">x</span>,<span class="var">y</span>) and the mouse at (<span class="var">mouseX</span>,<span class="var">mouseY</span>).</p>

<figure class="half-width-right" id="chapter01_figure15"><img alt="Figure 1.15" src="chapter01/ch01_15.png" />
<figcaption>Figure 1.15&nbsp;</figcaption>
<figcaption>Figure 1.15</figcaption>
</figure>

<p>In Figure 1.15, we see that we can get a vector (<span class="var">dx</span>,<span class="var">dy</span>) by subtracting the object&rsquo;s location from the mouse&rsquo;s location.</p>
Expand Down
14 changes: 7 additions & 7 deletions chapters/02_forces.html
Expand Up @@ -84,7 +84,7 @@ <h3>Newton&rsquo;s Third Law</h3>
<p>And if you are wearing roller skates when you push on that truck?</p>

<figure id="chapter02_figure2"><img alt="Figure 2.2" src="chapter02/ch02_02.png" />
<figcaption>Figure 2.2&nbsp;</figcaption>
<figcaption>Figure 2.2</figcaption>
</figure>

<p>You&rsquo;ll accelerate away from the truck, sliding along the road while the truck stays put. Why do you slide but not the truck? For one, the truck has a much larger mass (which we&rsquo;ll get into with Newton&rsquo;s second law). There are other forces at work too, namely the friction of the truck&rsquo;s tires and your roller skates against the road.</p>
Expand Down Expand Up @@ -645,7 +645,7 @@ <h2>2.7 Friction</h2>
<p>Here&rsquo;s the formula for friction:</p>

<figure id="chapter02_figure3"><img alt="Figure 2.3" src="chapter02/ch02_03.png" />
<figcaption>Figure 2.3&nbsp;</figcaption>
<figcaption>Figure 2.3</figcaption>
</figure>

<a data-primary="friction" data-secondary="determining direction/magnitude of" data-type="indexterm"></a>
Expand Down Expand Up @@ -749,7 +749,7 @@ <h5>Exercise 2.4</h5>
<h2>2.8 Air and Fluid Resistance</h2>

<figure id="chapter02_figure4"><img alt="Figure 2.4" src="chapter02/ch02_04.png" />
<figcaption>Figure 2.4&nbsp;</figcaption>
<figcaption>Figure 2.4</figcaption>
</figure>

<a data-primary="drag force" data-type="indexterm"></a> <a data-primary="fluid resistance" data-secondary="modeling" data-type="indexterm"></a> <a data-primary="forces" data-secondary="fluid resistance" data-type="indexterm"></a> <a data-primary="natural phenomena" data-secondary="fluid resistance" data-tertiary="modeling" data-type="indexterm"></a> <a data-primary="viscous force" data-type="indexterm"></a>
Expand Down Expand Up @@ -958,7 +958,7 @@ <h2>2.9 Gravitational Attraction</h2>
<a data-primary="gravity" data-secondary="modeling" data-type="indexterm"></a> <a data-primary="natural phenomena" data-secondary="gravity" data-type="indexterm"></a>

<figure class="half-width-right" id="chapter02_figure6"><img alt="Figure 2.6" src="chapter02/ch02_06.png" />
<figcaption>Figure 2.6&nbsp;</figcaption>
<figcaption>Figure 2.6</figcaption>
</figure>

<p>Probably the most famous force of all is gravity. We humans on earth think of gravity as an apple hitting Isaac Newton on the head. Gravity means that stuff falls down. But this is only <em>our</em> experience of gravity. In truth, just as the earth pulls the apple towards it due to a gravitational force, the apple pulls the earth as well. The thing is, the earth is just so freaking big that it overwhelms all the other gravity interactions. Every object with mass exerts a gravitational force on every other object. And there is a formula for calculating the strengths of these forces, as depicted in Figure 2.6.</p>
Expand Down Expand Up @@ -1006,7 +1006,7 @@ <h2>2.9 Gravitational Attraction</h2>
<p>Given these assumptions, we want to compute <span class="var">PVector force</span>, the force of gravity. We&rsquo;ll do it in two parts. First, we&rsquo;ll compute the direction of the force {unitr} in the formula above. Second, we&rsquo;ll calculate the strength of the force according to the masses and distance.</p>

<figure class="half-width-right" id="chapter02_figure7"><img alt="Figure 2.7" src="chapter02/ch02_07.png" />
<figcaption>Figure 2.7&nbsp;</figcaption>
<figcaption>Figure 2.7</figcaption>
</figure>

<p>Remember in <a href="#chapter01_section10">Chapter 1</a>, when we figured out how to have an object accelerate towards the mouse? (See Figure 2.7.)</p>
Expand All @@ -1031,7 +1031,7 @@ <h2>2.9 Gravitational Attraction</h2>
dir.mult(m);</pre>

<figure class="half-width-right" id="chapter02_figure8"><img alt="Figure 2.8" src="chapter02/ch02_08.png" />
<figcaption>Figure 2.8&nbsp;</figcaption>
<figcaption>Figure 2.8</figcaption>
</figure>

<p>The only problem is that we don&rsquo;t know the distance. <span class="var">G</span>, <span class="var">mass1</span>, and <span class="var">mass2</span> were all givens, but we&rsquo;ll need to actually compute distance before the above code will work. Didn&rsquo;t we just make a vector that points all the way from one location to another? Wouldn&rsquo;t the length of that vector be the distance between two objects?</p>
Expand All @@ -1058,7 +1058,7 @@ <h2>2.9 Gravitational Attraction</h2>
<p>Now that we&rsquo;ve worked out the math and the code for calculating an attractive force (emulating gravity), we need to turn our attention to applying this technique in the context of an actual Processing sketch. In Example 2.1, you may recall how we created a simple <span class="klass">Mover</span> object&mdash;a class with <span class="klass">PVector</span><code>&rsquo;s</code> location, velocity, and acceleration as well as an <span class="function">applyForce()</span>. Let&rsquo;s take this exact class and put it in a sketch with:</p>

<figure class="half-width-right" id="chapter02_figure9"><img alt="Figure 2.9" src="chapter02/ch02_09.png" />
<figcaption>Figure 2.9&nbsp;</figcaption>
<figcaption>Figure 2.9</figcaption>
</figure>

<ul>
Expand Down

0 comments on commit 69a1706

Please sign in to comment.