Ball on a Slanted Floor

Simulation and Modeling (CSCI 3010U)

Faisal Qureshi

Faculty of Science, Ontario Tech University

http://vclab.science.ontariotechu.ca

Discuss in class


Develop a simulation of a 2D ball bouncing off of a slanted floor as shown below.

Slanted Floor

For this simulation we assume the following:

Bonus

Technical notes

Computing the angle of reflection off of a slanted floor

Consider the figure shown below figure. \(\mathbf{i}\) represents the incoming direction. \(\mathbf{o}\) represents the outgoing direction. \(\mathbf{n}\) is the surface normal.

Reflection Angle

Notice that \[ 2 \mathbf{n} (\mathbf{i} . \mathbf{n}) = \mathbf{i} + \mathbf{o} \] Therefore, \[ \mathbf{o} = 2 \mathbf{n} (\mathbf{i} . \mathbf{n}) - \mathbf{i} \]

Submission

The exercise will be completed in class, and you do not need to submit anything. Be prepared to show your work to the instructor.

You can find starter code here.