# Difference between revisions of "Virtual Juggling"

Final Project
Physically Based Modeling
Comp 290.072
Spring 2000

For my final project in Physically Based Modeling (Comp 290.072) I have chosen to implement Virtual Juggling. This project uses physically based models for the objects being juggled and robotic style "mirror laws" to enable the hands to catch the juggled objects.

# The Problem of Juggling

Juggling presents a nontrivial, dynamic environment in which to simulate. There are normally multiple projectiles with interweaving paths. Human jugglers must use their hand-eye coordination to decide where the ball or club will be so that the hand may be placed in a position to catch it. Although a computer, if the programmer wanted to, could use its inherent knowledge of the complete state of its world to automatically calculate the best position to catch an object, I have chosen not to do this. Rather, just like a human juggler, my application makes use of only the current state of the world to decide where to place the hands when catching. It does this using robotic style "mirror laws" (which are explained below). This approach, I believe, more closely approximates how real jugglers juggle.

# Real Juggling

Real juggling can be done with almost any type of prop. Most props, however, fall into three different categories typified by the 3 most common juggling props: balls, rings, and clubs. These three props have very different characteristics that affect how they are juggled.

## Balls

With balls, all axes are equal and if the prop rotates in flight it does not matter.

## Rings

With rings, two axes are equal and one is small enough to be effectively nonexistent. This affects how the prop can rotate. Any rotation around the small axis is inconsequential, but rotation around either of the other axes can be difficult to control.

## Clubs

With clubs, two axes are relatively equal while one is fairly large (compared to the other two). This forces the club to rotate around an axis perpendicular to the juggler during the act of juggling.

No matter what type of prop used, there are several basic patterns employed in juggling. For a single juggler, the basic patterns are the cascade, fountain, shower, and multiplexing. A cascade is the standard juggling pattern where balls are alternatively thrown from one hand to another. It is normally used when juggling an odd number of objects. In the fountain pattern, balls are thrown and caught by the same hand. It is traditionally used for patterns consisting of an even number of objects. The shower pattern is the most commonly depicted juggling pattern. In a shower, all the balls are thrown in a circle. Even though many non-jugglers think of this pattern when thinking of juggling, it is a much more difficult pattern than either the cascade or the fountain. Multiplexing is when a juggler throws more than one object from a single hand simultaneously.

Patterns between multiple jugglers are based on the single person patterns. Most commonly, two jugglers will juggle in synchronized cascade patterns and periodically throw objects to the other person instead of to themselves. This is called passing. Another form of juggling involving multiple juggling is "buddy juggling." In buddy juggling, two people juggle as though they were only one person. One person can do all the juggling for one side while the other juggles for the other side (i.e. one person juggles the right hand and the other the left hand) or the jugglers can alternate which side they juggle. This can lead to many interesting effects where the objects being juggled go in a standard pattern while the jugglers interweave between each other.

# The Physics of Juggling

Juggling makes use of several key concepts. First, all motion, even that with complex rotation, can be considered standard projectile motion. Second, juggling patterns make use of periodic cycles. Patterns repeat, rather than change continuously. Third, the number of fundamental patterns is small. Through the use of these concepts juggling can easily be understood. Before we dive into that, however, let us define a few variables and equations.

## Some Definitions

Lets call the time between consecutive throws for one hand tau. Each hand travels in a circular pattern that has two states: holding an object and not holding an object. Let's call the time in which a hand is holding something the dwell time. The dwell time is obviously smaller than tau since tau is composed of both the dwell time and the non-dwell time. We not really concerned about the absolute length of the dwell time, but rather how does the dwell time compare to tau. Therefore, let's call theta the fraction of tau that is the dwell time. An immediate observation we should make is that theta will always be between 0 and 1 (and never equal to either). Given that, the dwell time (or the time an object spends in the hand) is tau * theta. Let's call the number of objects being juggled n.

Now, with those variables, let's give a few useful equations. First, let's consider the case where n is even. If n is even, then each hand (we're assuming two hands here) holds 0.5 * n objects and one full "cycle" of juggling (that is, at the end of the cycle, the objects are in the same location as when the cycle started) lasts for 0.5 * n * tau. However, because of the dwell time, the first object must land theta * tau earlier (that is, we consider the cycle to end when the last object is caught, not after its dwell time). Therefore, the time each object spends in the air (let's call it t) is equal to 0.5 * n * tau - theta * tau or simplified: t = 0.5 * tau (n - 2 * theta).

Since we know how long an object spends in the air, we can use the standard equation of projectile motion to determine how high the ball goes. The standard equation of projectile motion is r = r0 + v0*t + 0.5*g*t^2. (This can be found in any physics text.) At the apogee (that is, the highest point of the parabola made by the path of the object), the velocity of an object will be 0. If we also assume that the object was launched from a height of 0, we get the equation h = 0.5 * g * t^2 (note that ^ is the exponentiation operator). However, the t we calculated previously is actually twice the value of the t in this equation. Therefore, to unify the two equations, we must rewrite it to be: h = 0.5 * g * (0.5 * t)^2 or simplified: h = (1/8) * g * t^2. Substituting the value of t calculated previously, we get h = (1/32)*g*[(n-2*theta)^2]*tau^2.

We need to know, however, what initial velocity will allow us to reach the height h. At h, the velocity v will be equal to v0 - g*t1. Solving for t1 (the time to get to h), we get t1 = v0/g. We can substitute this into the standard equation for projectile motion and solve for v0. The equation starts out as h = v0 * (v0/g) - 0.5 * g * (v0/g)^2. Simplifying, we get v0 = sqrt(2*g*h). This gives us the initial velocity needed to reach a height h.

Some observations to be made are that tau and h are the limiting factors for successfully maintaining a juggle. Higher values of h must be aimed more accurately and smaller values of tau determine how fast a juggler must aim. While h is dependent upon the number of objects juggled (thereby ensuring that as the number of objects increase, the difficulty increases), tau can usually be adjusted. Most often tau falls in the range of 0.2 seconds to 0.8 seconds with a many jugglers having a tau of 0.5 seconds. Another factor in creating a stable juggling pattern is the value of theta. The vast majority of jugglers have a theta very close to 0.5 (i.e. the object is held for half the time the hand takes to travel in a circle). This encourages a strong pattern by ensuring that as one hand is throwing, the other is catching.