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


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

Re: Animating morphing Bezier curves; saving points

Started byChristopher Young <cy56@comcast.net>
First post2012-01-25 12:11 +0000
Last post2012-01-25 12:11 +0000
Articles 1 — 1 participant

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

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Animating morphing Bezier curves; saving points Christopher Young <cy56@comcast.net> - 2012-01-25 12:11 +0000

#8157 — Re: Animating morphing Bezier curves; saving points

FromChristopher Young <cy56@comcast.net>
Date2012-01-25 12:11 +0000
SubjectRe: Animating morphing Bezier curves; saving points
Message-ID<jforha$66e$1@smc.vnet.net>
Thanks to Juan for the help; that seems to fix the problem.
I'm still struggling to understand where we should have Dynamic calls. I 
thought John Fultz said that anything involving dynamic activity, 
including a Manipulate block, shouldn't directly call globals from an 
outside module. But this seems to work fine; at least there's no 
highlighting of the cell as there would be if useless "spinning" were 
going on.  Maybe DynamicModule is an exception to that rule. Still 
remains black magic to me.

> The order between DynamicModule and Manipulate should change:

DynamicModule[{P = {(*all the points*){-1, -1}, {-1, -.5}, {-1,
     0}, {-1, .5}, {-1, 1}, {1, -1}, {1, -.5}, {1, 0}, {1, .5}, {1, 1}},
 
  P1, P2,(*the points for each B=E9zier curve*)
 
  C1, C2,(*the B=E9zier curves*)
 
  PM,(*the points for the morphing B=E9zier curve*)
 
  CM              (*the morphing B=E9zier curve*)},

 P1 = Dynamic@Take[P, {1, 5}];
 P2 = Dynamic@Take[P, {6, 10}];
 PM[n_] := (1 - n) P1 + n P2;
 C1 = BezierCurve[P1, SplineDegree -> 5];
 C2 = BezierCurve[P2, SplineDegree -> 5];
 CM[n_] := BezierCurve[PM[n], SplineDegree -> 5];

 Manipulate[
  LocatorPane[
   Dynamic[P],
   Graphics[
    {
     Thick, Red, C1,
     Blue, C2,
     Purple, CM[n],
     Thin, Black, Dashed, Line[P1], Line[P2]},
   
    Axes -> True,
    PlotRange -> {{-1, 1}, {-1, 1}},
    GridLines -> {Range[-1, 1, .25], Range[-1, 1, .25]},
    GridLinesStyle -> LightGray
    ],
   {{-1, -1}, {1, 1}, {.25, .25}}, LocatorAutoCreate -> True
   ],
  {{n, 0}, 0, 1}
  ]
 ]

[toc] | [standalone]


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


csiph-web