Equations to model tennis ball motion

AI Thread Summary
Modeling tennis ball motion requires adapting projectile equations to account for the ball's initial velocity at impact, as traditional equations assume the ball is at rest. The current approach yields inaccurate results when the ball is already moving, necessitating a revision of the equations to incorporate this factor. While existing resources on ballistics often neglect the influence of current velocity, they provide a solid foundation for understanding projectile motion. The discussion emphasizes the importance of first establishing correct equations before coding, as combining both processes can complicate problem-solving. Further research into ballistics with air resistance and Magnus force may also enhance the accuracy of the model.
mariano_donat
Messages
8
Reaction score
0
I'm creating a tennis game and at this point I'm trying to model ball motion. I found multiple lectures on projectiles equations of motion which seem to apply well for when ball is not moving, but they do not take into account the velocity may have at the time of impact. For example, I found a function that gives me the angle of launch so ball can impact a target point at a given speed. If the ball is not moving, it works well, however if it is, it yields incorrect results. So how would one go about plugging current velocity in projectile equations of motion? For reference, this is how the function to calculate the angle looks like:

Code:
func launchAngle(speed: Float, distance: Float, yOffset: Float, gravity: Float, angle0: inout Float, angle1: inout Float) -> Bool {
        angle0 = 0
        angle1 = 0
  
        let speedSquared = speed * speed
        let operandA = powf(speed, 4)
        let operandB = gravity * (gravity * (distance * distance) + (2 * yOffset * speedSquared))
  
        if operandB > operandA {
            return false
        }
  
        let root = sqrt(operandA - operandB)
  
        angle0 = atan((speedSquared + root) / (gravity * distance))
        angle1 = atan((speedSquared - root) / (gravity * distance))
  
        return true
    }
 
Physics news on Phys.org
If I were doing this, I would first get the equations right and then launch into the coding. Trying to do it all in one step is likely to be fraught, particularly if you are discussing the problem with a third party. The first thing anyone on PF would need to do is to unpack your code and write it in algebraic form so it would be the courteous thing to present your question in algebraic form.
Have you done any searching on Google for ballistics with air resistance included? There are hundreds of hits with the equations in.
 
For now, I was neglecting air resistance + Magnus force to keep things simple. Equations are right, it's just that I don't seem to be able to find those taking into account ball's current velocity. All of them act from the perspective of "launching" a projectile in rest. I've been watching Sebastian Lague videos on youtube which were really helpful to get the basic equations to work, but even those do not contemplate current motion. So yes, I've been searching/reading a lot for the last couple of weeks and still couldn't find such equations. Doing a search with ballistics also does not seem to yield equations taking this into account.
 
Thread 'Is 'Velocity of Transport' a Recognized Term in English Mechanics Literature?'
Here are two fragments from Banach's monograph in Mechanics I have never seen the term <<velocity of transport>> in English texts. Actually I have never seen this term being named somehow in English. This term has a name in Russian books. I looked through the original Banach's text in Polish and there is a Polish name for this term. It is a little bit surprising that the Polish name differs from the Russian one and also differs from this English translation. My question is: Is there...
This has been discussed many times on PF, and will likely come up again, so the video might come handy. Previous threads: https://www.physicsforums.com/threads/is-a-treadmill-incline-just-a-marketing-gimmick.937725/ https://www.physicsforums.com/threads/work-done-running-on-an-inclined-treadmill.927825/ https://www.physicsforums.com/threads/how-do-we-calculate-the-energy-we-used-to-do-something.1052162/
Hi there, im studying nanoscience at the university in Basel. Today I looked at the topic of intertial and non-inertial reference frames and the existence of fictitious forces. I understand that you call forces real in physics if they appear in interplay. Meaning that a force is real when there is the "actio" partner to the "reactio" partner. If this condition is not satisfied the force is not real. I also understand that if you specifically look at non-inertial reference frames you can...
Back
Top