Skip to content

🐛 [Bug]: Missing input validation allows physically impossible negative launch speeds in Projectile Motion Calculator #706

@Shashank-8p

Description

@Shashank-8p
Image

📝 Description

The Projectile Motion Calculator lacks bounds checking and input validation for the "Launch Speed (m/s)" field. The application currently accepts negative numerical inputs (e.g., -10 m/s), executes the trajectory calculation, and renders a graph. Because speed is a scalar magnitude, a negative launch speed is physically meaningless in this context and leads to erroneous, nonsensical outputs (e.g., calculating a Time of Flight, Hmax, and Range for an impossible state).

🔄 Steps to Reproduce

  1. Open the "Projectile Motion Calculator" from the playground/utilities grid.
  2. Locate the "Launch Speed (m/s)" input field.
  3. Enter a negative numerical value (e.g., -10).
  4. Enter a valid Launch Angle (e.g., 45).
  5. Click the "Launch" button.
  6. See error: The calculation executes successfully, populating the TOF, Hmax, and Range pills, and rendering a trajectory graph, rather than throwing an input validation error.

🎯 Expected Behavior

The "Launch Speed (m/s)" input field must implement strict validation to reject values <= 0. If a user attempts to submit a negative value or zero, the application should prevent the calculation, prevent the graph animation, and display a clear UI error message (e.g., "Launch speed must be greater than 0").

❌ Actual Behavior / Error Logs

The component accepts negative input strings, coerces them into the physics calculation, and returns nonsensical mathematical outputs without alerting the user to the invalid physical state.

💻 Environment

  • OS: Windows 11
  • Browser: Chrome / Brave
  • File Name: Projectile Motion Calculator Component / Validation Logic

  • I am a registered GSSoC 2026 contributor.
  • I want to be assigned to fix this issue

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions