Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #8157 > unrolled thread
| Started by | Christopher Young <cy56@comcast.net> |
|---|---|
| First post | 2012-01-25 12:11 +0000 |
| Last post | 2012-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.
Re: Animating morphing Bezier curves; saving points Christopher Young <cy56@comcast.net> - 2012-01-25 12:11 +0000
| From | Christopher Young <cy56@comcast.net> |
|---|---|
| Date | 2012-01-25 12:11 +0000 |
| Subject | Re: 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}
]
]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web