create tangent vector calculating subroutine