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


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

Re: Animating morphing Bezier curves; saving points

From Christopher Young <cy56@comcast.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Animating morphing Bezier curves; saving points
Date 2012-01-25 12:11 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jforha$66e$1@smc.vnet.net> (permalink)
References <201201241007.FAA20271@smc.vnet.net> <04CAF9EBCB34694DA7E3A3BA4047DC3527F668C1C0@GVW0547EXC.americas.hpqcorp.net>

Show all headers | View raw


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}
  ]
 ]

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


Thread

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

csiph-web