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


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

Animating morphing Bezier curves; saving points

Started byChris Young <cy56@comcast.net>
First post2012-01-24 10:08 +0000
Last post2012-01-25 11:59 +0000
Articles 2 — 1 participant

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


Contents

  Animating morphing Bezier curves; saving points Chris Young <cy56@comcast.net> - 2012-01-24 10:08 +0000
    Re: Animating morphing Bezier curves; saving points Chris Young <cy56@comcast.net> - 2012-01-25 11:59 +0000

#8123 — Animating morphing Bezier curves; saving points

FromChris Young <cy56@comcast.net>
Date2012-01-24 10:08 +0000
SubjectAnimating morphing Bezier curves; saving points
Message-ID<jflvut$jql$1@smc.vnet.net>
The problem is that every time I start the animation, I lose the
positions of my points.

http://home.comcast.net/~cy56/Mma/MorphingB=C3=A9zier.nb
http://home.comcast.net/~cy56/Mma/MorphingB=C3=A9zierPic.png


Manipulate[
 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=C3=A9zier curve *)
   C1, C2,   (*
   the B=C3=A9zier curves *)
   PM,           (*
   the points for the morphing B=C3=A9zier curve *)
   CM              (*
   the morphing B=C3=A9zier curve *)
   },
 
  LocatorPane[
   Dynamic[P],
   
   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];
  
   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] | [next] | [standalone]


#8150

FromChris Young <cy56@comcast.net>
Date2012-01-25 11:59 +0000
Message-ID<jfoqr8$5m7$1@smc.vnet.net>
In reply to#8123
On 2012-01-24 10:08:29 +0000, Chris Young said:

> The problem is that every time I start the animation, I lose the
> positions of my points...

Here are the fixed links. Forgot I couldn't use an accent mark in a file name.

http://home.comcast.net/~cy56/Mma/MorphingBezier.nb
http://home.comcast.net/~cy56/Mma/MorphingBezierPic.png


[toc] | [prev] | [standalone]


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


csiph-web