Good to see more implementations.
I've also made one for more general TMA scenarios, without restrictions on time intervals, number of bearing inputs, or ownship movements. You can check the source code and formulas to see if it's useful to you. (
http://www.subsim.com/radioroom/showthread.php?t=240508)
If you're interested you can also check out the tool for Dangerous Waters, which performs line detection on any given image and draw TMA solutions on it, like this:
(green line is the solution)