A winform module that calculates trajectories of projectiles in freefall and in a vacume.

img_phys.png Take notice. This simulator is not intended to be used as a scientific tool. It treats all calculation as occurring in a vacuum and does not take into account air and wind resistance or drag coefficient. The source also contains some hard-coded values for example sake.

The source contains several classes:

cl_Physics – handles all needed physics calculations revolving around motion of projectiles.

cl_Math – holds some trigonometry calculations needed for cl_Physics.

cl_Draw – handles all processes of drawing.

cl_Object – represents a projectile of any sort and holds all the parameters and statues of the projectile.

cl_Graph – handles the plotting of the trajectory course on the graph.

fr_Main – form to handle input output.

A few notes regarding cl_Object. It is a static class, and it always represents one shot. If you intend to save trajectory coordinates it would be wise to turn it into a non static class. That way each cl_Object will represent a projectile on its own.

The example holds five kinds of courses:

‘Free fall’, demonstrates an object free falling under the force of gravity.

‘GTG Projectile’ – Ground to ground projectile, demonstrates the course of a projectile fired with an initial velocity on a certain angle.

‘ATG Projectile’ – Air to ground projectile, not the correct term but for ease of understanding. demonstrates the course of a “bomb” dropped from certain height and with initial velocity.

‘GTG Missile’, demonstrates the course of a missile with initial constant velocity. the effect of the constant velocity is defined by the amount of fuel set to the missile and the velocity force that the fuel can produce. this trajectory does not take into account acceleration.

‘AA’ – Anti Aircraft, a trajectory demonstrating “detonation” at specific height.


***

Download Source