I can just give you a short description what needs to be done:
What you need to do is to find a mapping from the space defined by the triangle into the space used by the normalmap-texture - or better said: the other way around.
From the texture-coordinates at the vertices and the vertices themselves you can derive where along the X- and Y-axes of the normalmap-texture-space go in the triangle-texture-space.