Enhance projectile motion calculations with validation #3049
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change
This PR improves the ground_to_ground_projectile_motion module by:
Adding input validation to ensure velocity is non-negative and angle is within 0–90°
Defining constants for rounding precision (ROUND_PRECISION_2, ROUND_PRECISION_3) and floating-point tolerance (EPSILON)
Updating the test() function to use tolerance-based assertions for floating-point comparison
Fixing documentation typos, including correcting the comment for degrees_to_radians
Adding Doxygen-style comments for all new constants and functions
These changes maintain the original output format and ensure all tests pass successfully.
Checklist
[x] Added file name matches File name guidelines
[x] Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
[x] Relevant documentation/comments is changed or added
[x] Search previous suggestions before making a new one, as yours may be a duplicate