• No results found

5.2 Scenario Simulation

5.2.1 Motion Simulation

5.2.1.1 The Throwing Scenario

The throwing scenario is animated using equations and constraints derived from the standard Newtonian equations of motion to create a simulation of the motion of a person throwing a ball in the air. There are two objects within the scenario – the ball and the thrower. The objects have two extra parameters each: a component of velocity for the horizontal and vertical dimensions. The complexity of this scenario is that, to add realism, each throw of the ball is thrown at a random angle with a random start point and a random apex, with each random element being generated using a truncated Gaussian distribution.

In order to improve intuition regarding what is being simulated before explaining how it is simulated, a selection of frames from the output of the throwing simulator, figure 5.1 and figure 5.2 are a selection of frames captured from the output video of the throwing scenario simulator. The noise added by the tracker simulator discussed in section 5.2.2 has been disabled so that the tracker noise can be discussed separately. Figure 5.1 shows a sample frame from the simulation. In the frame, the ball (represented by the blue box) is in mid-air having just been thrown upwards by the person (represented by the red box). The green outlines represent the track boxes for each object.

Figure 5.1: A sample frame from a video depicting the throwing scenario.The box representing the person is coloured red and the box representing the ball is coloured blue. The green outlines represent the track boxes for their respective objects.

Figure 5.2 shows a representative selection of 12 frames that occurred within a set of approximately 30 frames that happened within one second of the output video. This figure exists to show the kind of movement that occurs

in the output video. There are several features of the simulation that are worth highlighting. The first is that the ball can randomly have a small horizontal motion, as can be seen in the figure by the ball moving right. Secondly, the size of the box changes in size horizontally, tracking the ball’s horizontal movement, to simulate the person stretching their arms out to catch the ball.

This is then reversed in the last few frames as the person returns the ball to their core ready for another throw. The final feature worth highlighting is that because the simulator uses the Newtonian equations of motion, there are far fewer frames in the middle of the ball’s flight than those near the apex of the flight. This final feature may not be wholly apparent from the selection of frames. This is because, as mentioned earlier, over half the frames in the sequence were left out for the sake of making the differences in consecutive frames more noticeable.

Figure 5.2: A selection of frames depicting the kind of movement found in the throwing scenario. The box colours are the same as in figure 5.1.

The remainder of this subsection describes how this motion was simulated.

There are four input parameters to the throwing scenario: the acceleration due to gravity, the throwing acceleration due to the thrower, the catching deceleration due to the thrower and the maximum apex height of throw. The parameters for the throwing acceleration and catching deceleration may be modified if the chosen parameters are unable to allow the motion of the ball to fit within the constraints for the apex of a throw.

There are three phases for a single throw: the initial acceleration of the throw, the ball under the influence of gravity alone and the deceleration of the catch. Once the ball has reached a velocity of zero, the first phase begins again.

The height of the thrower defines a number of other important heights.

The height of the thrower defines the highest release height, the lowest release height, the highest catch height, the lowest catch height and the lowest possible height that the ball can be decelerated to zero. The thrower’s height defines

the highest release height because the release point cannot be higher than the height of the thrower’s reach, which is set at 1.25 times the thrower’s starting height. The thrower’s height defines the lowest apex height (and so the lowest release height) because the ball’s track box should always cease to overlap the thrower’s track box, this is defined to be 1.25 times the thrower’s starting height plus the height of the ball. The thrower’s height defines the highest catch height again because this must be within the thrower’s reach.

The thrower’s height defines the lowest possible height that the ball can be decelerated to zero because the ball must not go below a height that would not be reachable by the throwers arms – defined to be 0.25 times the thrower’s starting height. The lowest possible height for the ball to come to a stop due to deceleration then defines the lowest possible catch point due to the fixed deceleration.

It is these heights, the maximum apex height, the deceleration/acceleration due to gravity and the integral nature of time that defines the constraints on the throwing acceleration. The throwing acceleration must at least be large enough so that the maximum apex height is able to be reached by the longest possible acceleration time – which is constrained by the distance between the lowest height the ball can be at zero velocity and the highest possible release height. The throwing acceleration must be also small enough that the smallest possible amount of acceleration (1 frame’s worth) does not put it over the highest apex point. If the throwing acceleration is outside these constraints, then it is set to be the nearest value that satisfies the constraints.

The constraints on the catching deceleration are similarly derived. The minimum catching deceleration is defined to be the amount of deceleration needed to bring the ball to a halt at the minimum halt height from the maxi-mum catch height given the ball reached the maximaxi-mum apex height and was accelerated by gravity. The maximum catching deceleration is defined to allow the constrained throwing acceleration enough distance between the stop point and the highest release point for one frame’s worth of acceleration. Again, if the catching deceleration is outside the constraints, then it is set to be the nearest value that satisfies the constraints.

The random nature of the apex of each individual throw is controlled by varying the release height of the ball and so controlling how long the first phase lasts defines the velocity of the ball at release which defines the apex.

The release height is chosen at random from a truncated Gaussian distribution with a minimum and maximum release height as previously defined, a mean that is half way between the two truncation points and a standard deviation that is half the difference between the two truncation points. The random nature of the stop point of each individual catch is controlled by varying the catch height of the ball in the same manner to the way the apex of a throw is controlled but with the corresponding minimum and maximum catch points.

When watching a person throwing a ball, each throw is never directly up-wards. There is always at least a small amount of movement in the horizontal

axis. This is simulated in a similar manner to the vertical, though is simpler to calculate as there is no acceleration or deceleration of the ball due to gravity.

The width of the thrower determines the extreme left and right distance the ball is allowed to travel between release and catch, which are defined to be the centre of point of the thrower plus or minus two times the width of the thrower. Using a truncated Gaussian distribution, a point within these two extremes is selected using a mean equal to the centre point of the thrower and a standard deviation that is equal to the difference between the two extreme points. This selected point is then used as the point that the ball is caught on the horizontal. After the ball is caught it is decelerated so that it returns to the centre of the thrower. This means that unlike the vertical calculations, the horizontal throw acceleration and catch deceleration are not provided as parameters but are instead calculated. The throw acceleration is calculated to create the correct velocity so that it is at the correct point horizontally when it reaches the chosen vertical catch height. The catch deceleration is calcu-lated so that the ball decelerates to zero horizontal velocity when it reaches the centre of the thrower and that it reaches that point at the same time as the vertical velocity reaches zero.

The final part of the simulation is changing the size and shape of the rectangle representing the thrower to simulate the thrower reaching for the ball. This is done by having an original size and position and a current size and position. For the vertical reach simulation, if the release height is above the original height of the thrower, then the height of the thrower is increased so that the top edge of the thrower and the top edge of the ball remain the same until after the release point. While the ball is only acting under gravity, the height of the thrower is gradually increased up to the maximum height.

When the ball is moving downwards and when the top edge of the ball goes past the top edge of the thrower, regardless of when the ball is caught, the thrower’s height is reduced to keep the two top edges the same until it has been reduced back to the original height.

The thrower’s width is also changed to simulate the thrower reaching for the ball and tracking it as it moves horizontally. The width of the thrower is continually changed such that when the ball is flight, it is always directly above some part of the thrower. However, when the ball is caught, the thrower’s width moves back towards its initial width, simulating the thrower returning the ball to the core of their body.