๐ Projectile Motion – From Physics to Animation
Imagine throwing a ball into the air… it rises, slows down, and falls back. That curved path is called projectile motion.
In this guide, you’ll not only understand the physics—but also how to simulate and animate it.
๐ Table of Contents
- Inputs
- Core Physics
- Mathematical Formulas
- Simulation Steps
- Code Example
- CLI Output
- Visualization Logic
- Key Takeaways
- Related Articles
๐ฏ User Inputs
- Initial Velocity \(u\) (m/s)
- Angle \( \theta \) (degrees)
๐ง Core Physics Idea
Projectile motion is split into two independent parts:
- Horizontal motion → constant speed
- Vertical motion → affected by gravity
๐ Mathematical Formulas (Clearly Explained)
1. Convert Angle to Radians
\[ \theta_{rad} = \theta \times \frac{\pi}{180} \]
2. Velocity Components
\[ u_x = u \cdot \cos(\theta) \]
\[ u_y = u \cdot \sin(\theta) \]
3. Time of Flight
\[ T = \frac{2u_y}{g} \]
Simple meaning: How long the object stays in air.
4. Position at Time t
\[ x(t) = u_x \cdot t \]
\[ y(t) = u_y \cdot t - \frac{1}{2}gt^2 \]
5. Maximum Height
\[ H = \frac{u_y^2}{2g} \]
6. Range
\[ R = u_x \cdot T \]
⚙️ Simulation Steps
- Divide total time into small steps
- Compute x and y for each step
- Store positions
- Animate movement
๐ป Code Example (Python)
import numpy as np
u = 20
theta = np.radians(45)
g = 9.8
ux = u * np.cos(theta)
uy = u * np.sin(theta)
T = (2 * uy) / g
t = np.linspace(0, T, 50)
x = ux * t
y = uy * t - 0.5 * g * t**2
print("Range:", x[-1])
print("Max Height:", max(y))
๐ฅ️ CLI Output
Click to Expand
Range: 40.8 meters Max Height: 10.2 meters
๐ฌ Visualization Logic
To animate:
- Plot x vs y
- Move a point frame-by-frame
- Update position over time
๐ก Key Takeaways
- Projectile motion is predictable using physics
- Horizontal and vertical motions are independent
- Math formulas define the entire trajectory
- Simulation = applying formulas step-by-step
๐ฏ Final Thought
Once you understand these equations, you can simulate everything from throwing a ball… to launching a rocket.