Ask your own question, for FREE!
Computer Science 7 Online
OpenStudy (anonymous):

Box to wall collision in C

OpenStudy (anonymous):

I have a program I need to write in C that has a ball start at a randomly seeded origin point within a 2D box. From there, it uses a command line argument to decide the angle the ball is projected at. From there, we need to find the angle it bounces off, and how far away from the origin it was. Any ideas?

OpenStudy (e.mccormick):

When you look at a bounce off a flat surface, the direction is based on the angle. How you are going to do it is all goin to depend on how you are getting the slope or angle. |dw:1412355408367:dw|

OpenStudy (e.mccormick):

That leads to this: |dw:1412355433131:dw|

OpenStudy (e.mccormick):

By slope, note the difference is just the sign change on y. |dw:1412355553352:dw| By angle, you can find angles that match and do some math. and A+B=180 degrees, so you can do some angle math. |dw:1412355651995:dw|

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
2 days ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
2 days ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!