Oki. Just curious, you haven't thought about implementing a vertex/vector class, with overloaded operators for +,-,* etc? It all gets much easier that way.
I've done a vertex class that allows you to write most vector operations as you'd do when expressing it mathematically.
If I were to do someting similer I'd do
Vertex v0,v1,vertex0, vertex1, tangent;
v0 = vertex1 - vertex0;
v1 = vertex2 - vertex0;
tangent = cross(v0, v1);