Iterative process for creating a B Spline Curve points

*To*: mathgroup at smc.vnet.net*Subject*: [mg129453] Iterative process for creating a B Spline Curve points*From*: cesm <btl.kskr at gmail.com>*Date*: Mon, 14 Jan 2013 23:31:25 -0500 (EST)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Delivered-to*: l-mathgroup@wolfram.com*Delivered-to*: mathgroup-newout@smc.vnet.net*Delivered-to*: mathgroup-newsend@smc.vnet.net

Dear group I would like a elegant solution of this iterative process (probably using NestWhileList or FoldList). I want to discard While loop. Here, data is tensor field. rk and Fa is user=defined functions. rk gives 1x3 vector and Fa gives a number. curve[g_, i_, j_, firsteigenvector_] := Module[{n = 0, h = 0.1, x, y, z, x0 = g, y0 = i, z0 = j, v, tensor, fa, end, points}, {x[0],y[0],z[0]} = {x0, y0, z0}; chain = {{x[0],y[0],z[0]}}; While[1 <= x[n] < 112 && 1 <= y[n] < 112 && 1 <= z[n] < 50, Evaluate[ v[0] = firsteigenvector; v[n+1] = With[{tmp = rk[x[n],y[n],z[n],v[n]]}, Sign[v[n]*tmp]*tmp]; tensor[n+1] = data[x[n+1],y[n+1],z[n+1]] fa[n+1] = Fa[tensor[n+1]]; If[fa[n+1] >= 0.15, If[(0 < (VectorAngle[N[v[n+1]],N[v[n]]]*180/[Pi]) <70) || (290 <=(VectorAngle[N[v[n+1]],N[v[n]]]*180/[Pi]) < 360), points = AppendTo[points, {x[n+1],y[n+1],z[n+1]}], Goto[end]], Goto[end]] ]; n = n + 1]; Label[end]; points ] Any help is appreciated. cesm