Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #13153 > unrolled thread

Iterative process for creating a B Spline Curve points

Started bycesm <btl.kskr@gmail.com>
First post2013-01-15 04:28 +0000
Last post2013-01-15 04:28 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Iterative process for creating a B Spline Curve points cesm <btl.kskr@gmail.com> - 2013-01-15 04:28 +0000

#13153 — Iterative process for creating a B Spline Curve points

Fromcesm <btl.kskr@gmail.com>
Date2013-01-15 04:28 +0000
SubjectIterative process for creating a B Spline Curve points
Message-ID<kd2ltp$coi$1@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

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web