# Asteroid miners and course calculations

Mining asteroids is a lonely, dangerous job, and somebody's got to do it. And when they do, they need to map out their trajectories carefully so that fuel is used sparingly. (Hey, fuel is expensive in the 22nd century!) So we need to add a cost function that keeps track of how often we use the thruster and attitude jets.

We keep track of the current loss by subtracting fuel for each thrust of the rockets. If no fuel is left, or there isn't enough fuel for the actions to take place, then we cannot perform the given action and float forever in space. (Bummer!)

Now, this adds another consideration to our state equations: since fuel is mass, and mass affects acceleration, we must take into account this changing mass in our equations. The new mass calculation is now: MASS = SHIP_MASS + FUEL_MASS - THRUST_MASS.

# Warning, Will Robinson!

Here, now, we see the hovercraft magically jumping over the obstacles placed in its way. (For a better look, see this iamge) This problem exists because the obstacle is too small for the time interval to compensate. Since we are constantly changing velocities in this scenario, the problem is compounded.

The preferred solution would be to integrate along the computed path to determine whether an obstacle is hit. However, since such means are not at our immediate disposal, a function, computeIntersection(), was created to linearly interpolate along the path to find any obstructions. The number of discrete intervals are chosen in part by the length of the path to be examined. You can see the modified path here.

Unfortunately, this is not a complete solution. The model still considers the hovercraft to be a point-mass, and bad intersections still take place. The decoupled approach is not always best for this type of problem. This solution is still preferable on a small, experimental scale.

# But...

Unfortunately, the universe is not so simple. When we're flying long distances in space, we also need to be aware of gravitational objects that affect the course of a moving space vehicle.
Steven Bergom