Notion - Update docs

This commit is contained in:
shiffman 2024-02-24 19:42:34 +00:00 committed by GitHub
parent e4b74c4ead
commit 249950f5d5
2 changed files with 6 additions and 8 deletions

View file

@ -909,12 +909,12 @@ function draw() {
<p>Solving for <span data-type="equation">F_{gx}</span>, I get this:</p>
<div data-type="equation">F_{gx} = F_g \times \sin(\theta)</div>
<p>Ill now rename this force <span data-type="equation">F_p</span> for <em>force of the pendulum</em>. In Figure 3.21, Ive restored the diagram to its original orientation and relabeled the components. Ive also moved the starting point of <span data-type="equation">F_p</span> from the bottom of the right triangle to the bobs center, to clarify how this force moves the bob.</p>
<p>There it is. The net force of the pendulum that causes the rotation is calculated as follows:</p>
<div data-type="equation">F_p = F_g \times \sin(\theta)</div>
<figure>
<img src="images/03_oscillation/03_oscillation_18.png" alt="Figure 3.21: F_{gx} is now labeled F_p, the net force in the direction of motion.">
<figcaption>Figure 3.21: <span data-type="equation">F_{gx}</span> is now labeled <span data-type="equation">F_p</span>, the net force in the direction of motion.</figcaption>
</figure>
<p>There it is. The net force of the pendulum that causes the rotation is calculated as follows:</p>
<div data-type="equation">F_p = F_g \times \sin(\theta)</div>
<p>Lest you forget, however, my goal is to determine the angular acceleration of the pendulum. Once I have that, Ill be able to apply the rules of motion to find a new angle <span data-type="equation">\theta</span> for each frame of the animation:</p>
<div data-type="equation">\text{angular velocity} = \text{angular velocity} + \text{angular acceleration}</div>
<div data-type="equation">\text{angle} = \text{angle + angular velocity}</div>
@ -964,13 +964,11 @@ function draw() {
}</pre>
</div>
<p>Note that the acceleration calculation now includes a multiplication by 1. When the pendulum is to the right of its resting position, the angle is positive, and so the sine of the angle is also positive. However, gravity should pull the bob back toward the resting position. Conversely, when the pendulum is to the left of its resting position, the angle is negative, and so its sine is negative too. In this case, the pulling force should be positive. Multiplying by 1 is necessary in both scenarios.</p>
<div class="half-width-right">
<figure>
<img src="images/03_oscillation/03_oscillation_19.png" alt="Figure 3.22: The bob position relative to the pivot in polar and Cartesian coordinates">
<figcaption>Figure 3.22: The bob position relative to the pivot in polar and Cartesian coordinates</figcaption>
</figure>
</div>
<p>Next, I need a <code>show()</code> method to draw the pendulum on the canvas. But where exactly should I draw it? How do I calculate the x- and y-coordinates (Cartesian!) for both the pendulums pivot point (lets call it <code>pivot</code>) and bob position (lets call it <code>bob</code>)? This may be getting a little tiresome, but the answer, yet again, is trigonometry, as shown in Figure 3.22.</p>
<figure>
<img src="images/03_oscillation/03_oscillation_19.png" alt="Figure 3.22: The bob position relative to the pivot in polar and Cartesian coordinates">
<figcaption>Figure 3.22: The bob position relative to the pivot in polar and Cartesian coordinates</figcaption>
</figure>
<p>First, Ill need to add a <code>this.pivot</code> property to the constructor to specify where to draw the pendulum on the canvas:</p>
<pre class="codesplit" data-code-language="javascript">this.pivot = createVector(100, 10);</pre>
<p>I know the bob should be a set distance away from the pivot, as determined by the arm length. Thats my variable <code>r</code>, which Ill set now:</p>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 KiB

After

Width:  |  Height:  |  Size: 126 KiB