-The world around us moves in complicated and wonderful ways. We spend the earlier parts of our lives learning about our environment through perception and interaction. We expect the physical world around us to behave consistently with our perceptual memory, e.g., if we drop a rock, it will fall due to gravity, if a gust of wind blows, lighter objects will be tossed by the wind further. This class focuses on understanding, simulating, and incorporating motion-based elements of our physical world into the digital worlds that we create. Our hope is to create intuitive, rich, and more satisfying experiences by drawing from the perceptual memories of our users.
+The world around us moves in complicated and wonderful ways. We spend the earlier parts of our lives learning about our environment through perception and interaction. We expect the physical world around us to behave consistently with our perceptual memory, e.g., if we drop a rock, it will fall due to gravity, if a gust of wind blows, lighter objects will be tossed by the wind further. This class focuses on understanding, simulating, and incorporating motion-based elements of our physical world into the digital worlds that we create. Our hope is to create intuitive, rich, and more satisfying experiences by drawing from the perceptual memories of our users.
—James Tu, Dynamic Bodies course description, Spring 2003, ITP
In 2003, as a graduate student at the Interactive Telecommunications Program (ITP) in the Tisch School of the Arts at New York University, I enrolled in a course called Dynamic Bodies. The course was taught by interaction designer and ITP adjunct professor James Tu. At the time, my work was focused on a series of software experiments that generated real-time, nonphotorealistic imagery. The applications involved capturing images from a live source and “painting” the colors with elements that moved about the screen according to various rules. Tu’s course—which covered vectors, forces, oscillations, particle systems, recursion, steering, and springs—aligned perfectly with my work.
diff --git a/content/01_vectors.html b/content/01_vectors.html index 37b2e1ed..08ffa77b 100644 --- a/content/01_vectors.html +++ b/content/01_vectors.html @@ -837,7 +837,9 @@limit()
function constrains the magnitude of a vector.
this.velocity.limit(10);
This translates to the following:
-What is the magnitude of velocity
? If it’s less than 10, no worries; just leave it as is. If it’s more than 10, however, reduce it to 10!
+What is the magnitude of
+velocity
? If it’s less than 10, no worries; just leave it as is. If it’s more than 10, however, reduce it to 10!
Write the limit()
function for the p5.Vector
class:
Now comes an interesting question: How does the Mover
object talk to the Liquid
object? I want to implement the following:
When a mover passes through a liquid, that mover experiences a drag force.
++When a mover passes through a liquid, that mover experiences a drag force.
+
Translating that into object-oriented speak:
// If the liquid contains the mover, apply the drag force. if (liquid.contains(mover)) { diff --git a/content/03_oscillation.html b/content/03_oscillation.html index 1ee22667..fc01715b 100644 --- a/content/03_oscillation.html +++ b/content/03_oscillation.html @@ -710,14 +710,14 @@Exercise 3.12
Exploring the mathematics of triangles and waves has been lovely, but perhaps you’re starting to miss Newton’s laws of motion and vectors. After all, the core of this book is about simulating the physics of moving bodies. In “Properties of Oscillation”, I modeled simple harmonic motion by mapping a sine wave to a range of pixels on a canvas. Exercise 3.7 asked you to use this technique to create a simulation of a bob hanging from a spring with the sin()
function. That kind of quick-and-dirty, one-line-of-code solution won’t do, however, if what you really want is a bob hanging from a spring that responds to other forces in the environment (wind, gravity, and so on). To achieve a simulation like that, you need to model the force of the spring by using vectors.
I’ll consider a spring to be a connection between a movable bob (or weight) and a fixed anchor point (see Figure 3.14).
Exploring the mathematics of triangles and waves has been lovely, but perhaps you’re starting to miss Newton’s laws of motion and vectors. After all, the core of this book is about simulating the physics of moving bodies. In “Properties of Oscillation”, I modeled simple harmonic motion by mapping a sine wave to a range of pixels on a canvas. Exercise 3.7 asked you to use this technique to create a simulation of a bob hanging from a spring with the sin()
function. That kind of quick-and-dirty, one-line-of-code solution won’t do, however, if what you really want is a bob hanging from a spring that responds to other forces in the environment (wind, gravity, and so on). To achieve a simulation like that, you need to model the force of the spring by using vectors.
I’ll consider a spring to be a connection between a movable bob (or weight) and a fixed anchor point (see Figure 3.14).
The force of the spring is a vector calculated according to Hooke’s law, named for Robert Hooke, a British physicist who developed the formula in 1660. Hooke originally stated the law in Latin: “Ut tensio, sic vis,” or “As the extension, so the force.” Think of it this way:
The force of the spring is directly proportional to the extension of the spring.
In 1982, Lucasfilm researcher William T. Reeves was working on Star Trek II: The Wrath of Khan. Much of the movie revolves around the Genesis Device, a torpedo that, when shot at a barren, lifeless planet, has the ability to reorganize matter and create a habitable world for colonization. During the sequence, a wall of fire ripples over the planet while it’s being “terraformed.” The term particle system, an incredibly common and useful technique in computer graphics, was coined in the creation of this particular effect. As Reeves put it:
-A particle system is a collection of many, many minute particles that together represent a fuzzy object. Over a period of time, particles are generated into a system, move and change from within the system, and die from the system.
+A particle system is a collection of many, many minute particles that together represent a fuzzy object. Over a period of time, particles are generated into a system, move and change from within the system, and die from the system.
Since the early 1980s, particle systems have been used in countless video games, animations, digital art pieces, and installations to model various irregular types of natural phenomena, such as fire, smoke, waterfalls, fog, grass, bubbles, and so on.
This chapter is dedicated to looking at strategies for coding a particle system and managing the associated data. How do you organize your code? Where do you store information related to individual particles versus information related to the system as a whole? The examples I’ll cover will use simple dots for the particles and apply only the most basic behaviors. However, these characteristics shouldn’t limit your imagination. Just because particle systems tend to look sparkly, fly forward, or fall with gravity doesn’t mean that yours should have those characteristics too. By building on this chapter’s framework and adding more creative ways to render the particles and compute their behavior, you can achieve a variety of effects.
diff --git a/content/examples/06_libraries/6_3_boxes_and_boundaries/screenshot.png b/content/examples/06_libraries/6_3_boxes_and_boundaries/screenshot.png index 78e88fe1..d42ea222 100644 Binary files a/content/examples/06_libraries/6_3_boxes_and_boundaries/screenshot.png and b/content/examples/06_libraries/6_3_boxes_and_boundaries/screenshot.png differ diff --git a/content/images/01_vectors/01_vectors_1.png b/content/images/01_vectors/01_vectors_1.png index a0a31254..d434885c 100644 Binary files a/content/images/01_vectors/01_vectors_1.png and b/content/images/01_vectors/01_vectors_1.png differ diff --git a/content/images/02_forces/02_forces_1.png b/content/images/02_forces/02_forces_1.png index e0147a71..6ae7315e 100644 Binary files a/content/images/02_forces/02_forces_1.png and b/content/images/02_forces/02_forces_1.png differ diff --git a/content/images/05_steering/05_steering_1.png b/content/images/05_steering/05_steering_1.png index 8fab925d..25cc98a7 100644 Binary files a/content/images/05_steering/05_steering_1.png and b/content/images/05_steering/05_steering_1.png differ diff --git a/content/images/08_fractals/08_fractals_10.png b/content/images/08_fractals/08_fractals_10.png index 205a5608..8bb24338 100644 Binary files a/content/images/08_fractals/08_fractals_10.png and b/content/images/08_fractals/08_fractals_10.png differ diff --git a/content/images/09_ga/09_ga_1.png b/content/images/09_ga/09_ga_1.png index 6a1dc6e3..93d9bf12 100644 Binary files a/content/images/09_ga/09_ga_1.png and b/content/images/09_ga/09_ga_1.png differ