Sie sind auf Seite 1von 2

Billiards Function

The billiards table of interest has a playing surface that is 92 inches long by 46 inches wide. Of the many games that can be played, the one of interest here is one that scores points for predicting the number of bounces a ball will make before it enters the pocket. Though a modern billiards table has 6 pockets, 4 at the corners and one in the center of each long side, we are concerned here only with corner pockets. We believe the function we derive could be extended to consider side pockets.

Concept
Consider the following diagram. We want to write a function that will describe the paths taken (solid blue, gray lines) from the ball position (B0) to the pocket (P0) based on the number of bounces. Only x-direction bounces are shown in this diagram, but we are also interested in y-direction bounces.
X1 B0 P1 P2 P2' B1 X2 B2

Out[11]=

P3

P0

One way to write the desired function in the case of one (1) bounce is to find the line P0-B1 and map the portion P1B1 into coordinates P1-B0. Similarly, for the case of two (2) bounces, we can find line P0-B2 and map the P3-B2 portion of it back into coordinates to the left of X1. We recognize that for this concept to work, the point B1 must be a reflection of point B0 about the boundary line X1. Similarly, point B2 is a reflection of point B1 about the boundary line X2. Effectively, B2 is a translation of B0. We see that if we were to extend the concept farther to the right, we would alternate segments where the point Bk is a translated reflection (k odd) or simply a translation (k even) of point B0. If the x dimension of B0 is given by x0, and if the x dimension of boundary X1 has value dx, then we can find the x dimension of point Bk (which we call x(k)) from the equation x(k) = (-1)^k*x0 + (k + Mod(k, 2))*dx Without straining too hard, we can imagine the same concept applies in the y direction.

Reflect Coordinate N Times


We think of this process of translating the coordinates of B0 as a process of reflection. Accordingly, the function name r is attached to the function that creates a reflection Bk of B0 such that k bounces will be made before the ball hits the pocket.
In[12]:=

r@x0_, k_, dx_D := HH- 1L ^ kL x0 + Hk + Mod@k, 2DL dx

This function can be applied in both the x and the y directions.

Collapse Reflected Coordinate


Because we want a function that will let us draw the line (for example) P0-P1-B0, we need a way to map the line P1B1 back into the space to the left of X1. A combination of modulo and absolute value functions has the necessary behavior for this purpose. We think of this process as collapsing the line into the desired coordinate space. Accordingly, the function that does this mapping is named with a c.
In[13]:=

c@x_, dx_D := dx - Abs@Mod@x, 2 dxD - dxD

Billiards 1.nb

Billiards Function
If we know the location of point Bk, and if the pocket is at the origin (P0 = {0, 0}), any point on the line P0-Bk can be found as t*Bk, using scalar parameter t such that 0 t 1. Because the ball normally proceeds from its initial location to the pocket, we define the line so that {x, y} = Bk for t=0 {x, y} = {0, 0} for t=1. Thus point P(t) on the line P0-Bk will actually be P(t) = (1-t)*Bk Remembering that we can separately specify the number of bounces in the x and y directions, and realizing that the collapse function c() must be separately applied to the x and y coordinates of P(t), we can define our billiards function. We will call this function sinkIt(), and we will supply it with two lists and the parameter t. Each list has the coordinate of B0, the number of bounces in that coordinate direction, and the dimension of the billiards table in that coordinate direction. In the x direction, the list is {x0, Nx, xDim} In the y direction, the list is {y0, Ny, yDim}. The function returns {x(t), y(t)}, that is, the coordinates of the point P(t) folded to lie within the bounds of the billiards table.
In[14]:=

sinkIt@8x0_, Nx_, xDim_<, 8y0_, Ny_, yDim_<, t_D := 8c@H1 - tL r@x0, Nx, xDimD, xDimD, c@H1 - tL r@y0, Ny, yDimD, yDimD<

Plot of Billiards Function


Here, we have plots of the billiards function for 0 bounces (red), 1 bounce (blue, green), 2 bounces (gray), and 20 bounces (orange).

Out[16]=

Das könnte Ihnen auch gefallen