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.
 
The rope is tied into the person (the load of 200 pounds) and the rope goes up from the person to a fixed pulley and back down to his hands. He hauls the rope to suspend himself in the air. What is the mechanical advantage of the system? The person will indeed only have to lift half of his body weight (roughly 100 pounds) because he now lessened the load by that same amount. This APPEARS to be a 2:1 because he can hold himself with half the force, but my question is: is that mechanical...
Some physics textbook writer told me that Newton's first law applies only on bodies that feel no interactions at all. He said that if a body is on rest or moves in constant velocity, there is no external force acting on it. But I have heard another form of the law that says the net force acting on a body must be zero. This means there is interactions involved after all. So which one is correct?
Thread 'Beam on an inclined plane'
Hello! I have a question regarding a beam on an inclined plane. I was considering a beam resting on two supports attached to an inclined plane. I was almost sure that the lower support must be more loaded. My imagination about this problem is shown in the picture below. Here is how I wrote the condition of equilibrium forces: $$ \begin{cases} F_{g\parallel}=F_{t1}+F_{t2}, \\ F_{g\perp}=F_{r1}+F_{r2} \end{cases}. $$ On the other hand...
Back
Top