Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Animating morphing Bezier curves; saving points

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124580] Re: Animating morphing Bezier curves; saving points
  • From: Christopher Young <cy56 at comcast.net>
  • Date: Wed, 25 Jan 2012 07:07:00 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201201241007.FAA20271@smc.vnet.net> <04CAF9EBCB34694DA7E3A3BA4047DC3527F668C1C0@GVW0547EXC.americas.hpqcorp.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}
  ]
 ]



  • Prev by Date: Re: Infinite Series Error - Bug?
  • Next by Date: Colored, indexed, resizable locators
  • Previous by thread: Animating morphing Bezier curves; saving points
  • Next by thread: Re: Animating morphing Bezier curves; saving points