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


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

Iterative process for creating a B Spline Curve points

From cesm <btl.kskr@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Iterative process for creating a B Spline Curve points
Date 2013-01-15 04:28 +0000
Message-ID <kd2ltp$coi$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web