Reference no: EM132109296
Project Intercept
You need c++ code for this please!!!!!
The client wants a simulation of a target and a weapon launcher and intercept projectile.
1. The Launcher will fire a projectile at a target the Launcher is static, the projectile follows a linear path. The projectile has a known velocity (speed and direction).
2. The Target will be traveling in a circular path, with a given center and radius. The Target has a known speed.
3. Launcher and Target will be given known initial positions.
4. The Launcher will fire the projectile in an appropriate direction so to intercept the Target at some time t.
Objects:
Target, Launcher and Projectile.
The Target has:
initial position, current position, trajectory (center, radius and speed)
The Target has functions:
Constructor, destructor, display, associated gets/sets, move().
The Launcher has:
initial position, projectile, targeting information (ref angle)
Constructor, destructor, display, gets/sets, fire()
The Projectile has
initial position = Launcher position, velocity and a linear trajectory
Constructor, destructor, display, associated gets/sets, move().
Final Comments. After initialization, the launcher will compute the ideal ref angle and fire the projectile.
The projectile will travel a set distance each time step = speed of the projectile.
The Target will move along the circular path at each time step a distance = speed of the target
At time T, the project will intercept the Target and destroy it.
1. design the tests for each of the objects
correctly passing when it should, and fail when it should not pass
2. define the objects and their functions
3. design the algorithm to solve the problem:
---------------------------------------------------Al Gores' Rhythm-------------------------------------
1. compute the new position of the target on the circle, Tx, Ty (spd = arc length on circle)
a) given Target's current position Tx,Ty, compute initial reference angle theta
b) compute the circumference of the path of the target, C = 2PI*R
c) the reference angle for the target per time step, how far is it moving in one time unit then is 360*Spd/C = alpha
theta = theta - alpha
d) dx = r sin(theta), dy = r cos(theta)
2. compute the equation of the line from Launcher (Lx, Ly) to Target (Tx, Ty)
a) find slope m = (Ty-Ly)/(Tx-Lx)
b) use slope m and either Tx,Ty or Lx,Ly to find b --> yielding y = mx + b
3. using y = mx+b and speed of projectile and the number of time steps to find the Px,Py
4. find the distance from Px,Py to Tx, Ty....yielding impact or go again.