Geogebra Basketball 3D – v3 (with rebounds)

New version with “exact” parables

NOTE:
This applet is too complicated to be run online through the web interface. To try it it’s essential to download the “.ggb” geogebra file (https://www.geogebra.org/material/download/format/file/id/MDf2mBqj) and run it it locally through the free Geogebra Classic desktop program, that is free and available at this page.

Basic operation

Click “New Trial” to position the shooter (the shooter will be placed randomly on the half-field). Through the sliders adjust the parameters “\alpha” (horizontal direction), “\phi” (vertical inclination) and “‍v0‍” to direct the shoot to the basket.

Alternatively you can use the buttons to automatically set the parameters:

“set \alpha“: will set the right horizontal direction
“set \phi“: will set the right vertical slope of the shoot (given the actual value of v0‍)
“set v0‍” : will set the right speed of the shoot (given the actual value of ).

Click “Shoot” to start the animation.

See the result and repeat the operation.

Other parameters and buttons
\alpha  fine tuning”: if checked the minimum and maximum values of the slider a will be closer to the correct horizontal direction, making easier to fine tuning its value.
dmpflo”: the amount of dumping or speed reduction of the ball after it hits the floor. A value of 0.8 works fine.
“dmprim”: the amount of dumping or speed reduction of the ball after it hits the rim. A value of 0.7 works fine.
“dmpbb”: the amount of dumping or speed reduction of the ball after it hits the backboard. A value of 0.8 works fine.
spd”: the speed of the animation. Values in the range of 0.6-0.8 make the animation not too much slow and work fine. With greater values the accuracy of the rebounds decreases and there could even be no detection of an impact event.
SaveCstmIC” button: in case an interesting starting condition is found (i.e, one with nice rebounds) it’s possible to save its relevant parameters (position of the player, direction and speed of the shot).
RestoreCstmIC” button: to restore the previously saved starting condition.

Visual aids

  • The “hmax” (point) is the vertex of the initial parabola.
  • A blue point on the backboard marks the point of impact of the ball with the backboard. In case of no impact this point is smaller and lighter and take the meaning of the point of intersection between the ball initial trajectory and the plane of the backboard.
  • There is a moving gray disk representing the ball projection (shadow) on the floor.
  • In the 3D window there are buttons to quickly change the point of view.

Possible issues:

  • The simulation may become slow and jerky after some trials (with the time slider no more running as smoothly as at the beginning). I suspect this could be due to some problem in Java/Geogebra memory management when the complexity of the simulation and the amount of calculations required are, like in this case, very demanding.
    If that happens the solution is to quit geogebra and start it again.
  • There might be errors in case of very complicated subsequent rebounds with the rim.
  • If the speed of the animation is too high rebounds and the result of the shot may not be properly calculated.

How does it work

Without entering into much details the basic scheme of the inner workings of this simulation is the following:

  1. Initially the ball follows a 3D parabola (set as a parametric curve) fixed by the initial conditions (player position, shot direction and initial speed). The initial conditions are stored in the icstart list that is copied as a free object in the ic00 list.
  2. The ball position is driven by the t slider.
  3. At time 0 also the next point of impact of the ball is calculated. This will allow to predetermine what will be the next time of impact (t1) and the next parabola (stored in the ic01 list).
  4. When the running time t reaches t1 the initial conditions are updated: ic01 is copied into ic00 and the next initial condition ic01 and impact time t1 are pre-calculated and stored in their respective variables.
  5. Then, after each impact, there is then a new starting time and a new initial condition together with the starting time and initial condition of the following stage.
  6. The process can be repeated till the maximum t predefined value. With this procedure there’s no need to know in advance how many rebounds there will be.

The hardest part in building this simulation was the calculation of the rebounds with the rim. That was essentially achieved by making Geogebra find the intersection points (K1..K4) between the ball parabola and the profile line of the intersection between the plane of the parabola and a torus.
It seems to work even if there might be issues in some complex cases with multiple rebounds.

The 2D Graphics view shows the 3D simulation projected in the 2D plane of the ball trajectory. It’s purpose is just for development and for checking what’s going on with subsequent impacts  of the ball with obstacles (especially the rim).

Last edited: 22 july 2017