def deform2curve(script, curve=mp_func.torus_knot('<STR_LIT:t>'), step=<NUM_LIT>):
curve_step = []<EOL>for idx, val in enumerate(curve):<EOL><INDENT>curve[idx] = val.replace('<STR_LIT:t>', '<STR_LIT:z>')<EOL>curve_step.append(val.replace('<STR_LIT:t>', '<STR_LIT>'.format(step)))<EOL><DEDENT>tangent = mp_func.v_subtract(curve_step, curve)<EOL>normal1 = mp_func.v_add(curve_step, curve)<EOL>bee = mp_func.v_cross(tangent, normal1)<EOL>normal = mp_func.v_cross(bee, tangent)<EOL>bee = mp_func.v_normalize(bee)<EOL>normal = mp_func.v_normalize(normal)<EOL>new_point = mp_func.v_add(mp_func.v_multiply('<STR_LIT:x>', normal), mp_func.v_multiply('<STR_LIT:y>', bee))<EOL>function = mp_func.v_add(curve, new_point)<EOL>vert_function(script, x_func=function[<NUM_LIT:0>], y_func=function[<NUM_LIT:1>], z_func=function[<NUM_LIT:2>])<EOL>return function<EOL>
Deform a mesh along a parametric curve function

    Provide a parametric curve function with z as the parameter. This will
    deform the xy cross section of the mesh along the curve as z increases.

    Source: http://blackpawn.com/texts/pqtorus/

    Methodology:
    T  = P' - P
    N1 = P' + P
    B  = T x N1
    N  = B x T

    newPoint = point.x*N + point.y*B