Projectile Motion from a Building: 2D Trajectory Explorer
Problem
A ball is thrown from the top of a building of height 20 m with an initial velocity of 15 m/s at an angle of 30° above the horizontal.
Explanation
We model the motion of a ball thrown from the top of a building using standard projectile motion equations.
Problem Setup
A ball is thrown from the top of a building:
- Building height:
- Initial speed:
- Launch angle: above the horizontal
- Gravitational acceleration: (downward)
We assume:
- No air resistance
- Constant gravitational field
- 2D motion (horizontal and vertical )
We choose the origin at the base of the building, with:
- axis: horizontal, positive to the right
- axis: vertical, positive upward
Thus the ball starts at .
Decomposing the Initial Velocity
The initial velocity vector is split into horizontal and vertical components:
For and :
So:
Position as a Function of Time
Ignoring air resistance, the horizontal motion is uniform, and the vertical motion is uniformly accelerated.
Horizontal position:
(since we choose ).
Vertical position:
with .
So explicitly:
Time of Flight (Landing Time)
The ball hits the ground when .
Solve
This is a quadratic in :
Multiply by for convenience:
Using the quadratic formula with:
Plugging in values (keeping it symbolic here):
There will be two solutions, one negative (non-physical for forward time) and one positive. We take the positive root as the total time of flight .
Once is known, the horizontal range is:
The visualization computes this time numerically and shows:
- The full trajectory curve from to .
- The ball position at an animated time that loops from launch to landing.
Understanding the Visualization
This interactive canvas shows:
- A dark background with neon curves for the trajectory.
- A building on the left with its height representing .
- The ball moving along the parabolic path.
- Vector arrows for the initial velocity components, and (when toggled on).
- (Optionally) a faded ghost trajectory for reference while you change parameters.
Controls
- Initial Velocity (m/s): Changes and therefore both range and maximum height.
- Angle (degrees): Changes , controlling how much of is vertical vs horizontal.
- Gravity (m/s²): Adjusts , letting you explore motion on different planets.
- Time Scale: Speeds up or slows down the animation in time.
- Show Vectors: Toggles the display of the initial velocity components.
- Show Full Path: Toggles the drawn full trajectory.
Cartesian vs Canvas Coordinates
The math uses a standard Cartesian system with positive upwards, but the HTML canvas has increasing downwards. To map physics coordinates to canvas , we use:
where is a pixel-per-meter scale and the offsets place the origin near the ground at the base of the building.
How to Use This to Understand the Problem
- Start with the default values (15 m/s, 30°) and watch the trajectory.
- Increase the angle towards 90° to see more vertical motion and shorter horizontal range.
- Decrease the angle towards 0° to see a flatter, more horizontal throw from the building.
- Change gravity to see how the same initial throw behaves on different worlds (e.g., Moon vs Earth).
Under the hood, the animation simply evaluates:
for many points in time between and the landing time , and then maps these coordinates to the canvas for drawing the smooth path and the moving ball.