This is a direct port / translation of mikktspace, originally written by Morten S. Mikkelsen.
The only changes made to the code was to enable it to compile in Haxe, and hence might be less-than-optimal. The code is self-contained and has no dependencies.
Note that I only did a single test with a teapot mesh.
The code is licensed under the MIT License.