Notion - Update docs

This commit is contained in:
shiffman 2023-02-06 00:41:19 +00:00 committed by GitHub
parent 4355ed67dc
commit 59b3377c53
5 changed files with 7 additions and 7 deletions

View file

@ -193,8 +193,8 @@ position = position + velocity;</pre><a data-type="indexterm" data-primary="addi
<p>In other words:</p>
<div data-type="equation">\vec{w} = \vec{u} + \vec{v}</div>
<p>can be written as:</p>
<div data-type="equation">w_x = u_x - v_x</div>
<div data-type="equation">w_y = u_y - v_y</div>
<div data-type="equation">w_x = u_x + v_x</div>
<div data-type="equation">w_y = u_y + v_y</div>
<p>Then, replacing <code>u</code> and <code>v</code> with their values from Figure 1.6, you get:</p>
<div data-type="equation">w_x = 5 + 3</div>
<div data-type="equation">w_y = 2 + 4</div>

View file

@ -947,7 +947,7 @@ function draw() {
bob.display();
spring.display();
}</pre>
<p>You may notice here that this is quite similar to what I did in <a href="/forces#example-26-attraction">Example 2.6</a> with an attractor. There, I wrote something like:</p>
<p>You may notice here that this is quite similar to what I did in <a href="/force#example-26-attraction">Example 2.6</a> with an attractor. There, I wrote something like:</p>
<pre class="codesplit" data-code-language="javascript"> let force = attractor.attract(mover);
mover.applyForce(force);</pre>
<p>The analogous situation here with a spring would be:</p>

View file

@ -755,7 +755,7 @@ class Cat extends Animal {
this.lifespan -= 2.0;
}</pre>
<p>The <code>Particle</code> class is structured to have a constant acceleration, one that never changes. A better framework would be to return to Newtons second law (F = M * A) and incorporate the force accumulation algorithm from <a href="/forces#23-force-accumulation">Chapter 2</a>.</p>
<p>The <code>Particle</code> class is structured to have a constant acceleration, one that never changes. A better framework would be to return to Newtons second law (F = M * A) and incorporate the force accumulation algorithm from <a href="/force#23-force-accumulation">Chapter 2</a>.</p>
<p>Step 1 is to add in the <code>applyForce()</code> function. (Remember, you need to make a copy of the <code>p5.Vector</code> before dividing it by mass.)</p>
<pre class="codesplit" data-code-language="javascript"> applyForce(force) {
let f = force.copy();
@ -904,7 +904,7 @@ class ParticleSystem {
}
}</pre>
<h2 id="412-particle-systems-with-repellers">4.12 Particle Systems with Repellers</h2><a data-type="indexterm" data-primary="forces" data-secondary="applying to single objects in a system"></a><a data-type="indexterm" data-primary="particle systems" data-secondary="applying force to single particles in"></a><a data-type="indexterm" data-primary="particles" data-secondary="applying force to single particles in"></a>
<p>What if I wanted to take this example one step further and add a <code>Repeller</code> object—the inverse of the <code>Attractor</code> object covered in <a href="/forces#29-gravitational-attraction">Chapter 2</a> that pushes any particles away that get close? This requires a bit more sophistication because, unlike the gravity force, each force an attractor or repeller exerts on a particle must be calculated for each particle.</p>
<p>What if I wanted to take this example one step further and add a <code>Repeller</code> object—the inverse of the <code>Attractor</code> object covered in <a href="/force#29-gravitational-attraction">Chapter 2</a> that pushes any particles away that get close? This requires a bit more sophistication because, unlike the gravity force, each force an attractor or repeller exerts on a particle must be calculated for each particle.</p>
<div class="col-list">
<div>
<figure>

View file

@ -90,7 +90,7 @@ desired.mult(this.maxspeed);</pre>
// to the objects acceleration
this.applyForce(steer);
}</pre>
<p>Note how in the above function I finish by passing the steering force into <code>applyForce()</code>. This assumes that the the code is built on top of the foundation built in <a href="/forces#22-forces-and-p5jsnewtons-second-law-as-a-function">Chapter 2</a>. However, you could just as easily use the steering force with Box2Ds <code>applyForce()</code> function or toxiclibs <code>addForce()</code> function.</p>
<p>Note how in the above function I finish by passing the steering force into <code>applyForce()</code>. This assumes that the the code is built on top of the foundation built in <a href="/force#22-forces-and-p5jsnewtons-second-law-as-a-function">Chapter 2</a>. However, you could just as easily use the steering force with Box2Ds <code>applyForce()</code> function or toxiclibs <code>addForce()</code> function.</p>
<p>So why does this all work so well? Lets see what the steering force looks like relative to the vehicle and target positions.</p>
<figure>
<img src="images/05_steering/05_steering_4.png" alt="Figure 5.4">

View file

@ -1 +1 @@
[{"title":"Introduction","src":"./00_7_introduction.html","slug":"introduction"},{"title":"1. Vectors","src":"./01_vectors.html","slug":"vectors"},{"title":"2. Forces","src":"./02_forces.html","slug":"forces"},{"title":"3. Oscillation","src":"./03_oscillation.html","slug":"oscillation"},{"title":"4. Particle Systems","src":"./04_particles.html","slug":"particles"},{"title":"5. Autonomous Agents","src":"./05_steering.html","slug":"autonomous-agents"},{"title":"6. Physics Libraries","src":"./06_libraries.html","slug":"physics-libraries"},{"title":"7. Cellular Automata","src":"./07_ca.html","slug":"cellular-automata"},{"title":"8. Fractals","src":"./08_fractals.html","slug":"fractals"},{"title":"9. The Evolution of Code","src":"./09_ga.html","slug":"genetic-algorithms"}]
[{"title":"Introduction","src":"./00_7_introduction.html","slug":"introduction"},{"title":"1. Vectors","src":"./01_vectors.html","slug":"vectors"},{"title":"2. Forces","src":"./02_forces.html","slug":"force"},{"title":"3. Oscillation","src":"./03_oscillation.html","slug":"oscillation"},{"title":"4. Particle Systems","src":"./04_particles.html","slug":"particles"},{"title":"5. Autonomous Agents","src":"./05_steering.html","slug":"autonomous-agents"},{"title":"6. Physics Libraries","src":"./06_libraries.html","slug":"physics-libraries"},{"title":"7. Cellular Automata","src":"./07_ca.html","slug":"cellular-automata"},{"title":"8. Fractals","src":"./08_fractals.html","slug":"fractals"},{"title":"9. The Evolution of Code","src":"./09_ga.html","slug":"genetic-algorithms"}]