Manipulate[v = pt2 - pt1;
{Graphics[Arrow[{pt1, pt2}], PlotRange -> 2],
ParametricPlot3D[{v[[1]] Cos[u], v[[2]] Sin[u], u}, {u, 0, 4 Pi},
PlotRange -> {{-2, 2}, {-2, 2}},
ColorFunction -> Function[{x, y, z, u}, Hue[u]],
PlotStyle -> Thick]}, {{pt1, {0, 1}}, Locator}, {{pt2, {1, 0}},
Locator}]
Any ideas?
Module[
{pt1 = {1, 0}, pt2 = {0, 1}},
Row[{
Graphics[
{Dynamic@Arrow[{pt1, pt2}],
Locator[Dynamic[pt1]],
Locator[Dynamic[pt2]]},
PlotRange -> 2,
ImageSize -> 200],
Dynamic@
ParametricPlot3D[{Part[pt2 - pt1, 1] Cos[u],
Part[pt2 - pt1, 2] Sin[u], u}, {u, 0, 4 Pi},
PlotRange -> {{-2, 2}, {-2, 2}},
ColorFunction -> Function[{x, y, z, u}, Hue[u]],
PlotStyle -> Thick,
ImageSize -> 350,
BoxRatios -> {1, 1, 1}]}]
]
You could use DynamicModule, but it really isn't necessary here. The
Locators are confined to the lhs plot and not imposed on the entire display.
In the code above I bypassed calculating the v variable you used. Let's
reintroduce v. Quite often we might have a set of primary dynamic variables,
such as pt1 and pt2 here, which are manipulated by the mouse or sliders or
other dynamic elements, and a set of dependent dynamic variables that depend
on the primary variables, such as v here. We can handle this situation as in
the following code. Here we use the two argument form of Dynamic and when a
primary dynamic variable is adjusted the routine calcAll is called to
calculate all the dependent quantities (only v in this case). I've also made
some stylistic changes to the display.
Module[
{(* Primary dynamic variables *)
pt1 = {1, 0}, pt2 = {0, 1},
(* Dependent dynamic variable *)
v,
(* Other variables *)
calcAll},
calcAll[p1_, p2_] := (v = p2 - p1);
(* Initialize dependent variables *)
calcAll[pt1, pt2];
(* Display *)
Panel[
Row[{
Graphics[
{Arrowheads[.1],
Dynamic@Arrow[{pt1, pt2}],
Locator[Dynamic[pt1, (pt1 = #; calcAll[pt1, pt2]) &],
Graphics[{AbsolutePointSize[8], Point[{0, 0}]},
ImageSize -> 10]],
Locator[Dynamic[pt2, (pt2 = #; calcAll[pt1, pt2]) &], None]},
PlotRange -> 2,
ImageSize -> 200],
Dynamic@
ParametricPlot3D[{v[[1]] Cos[u], v[[2]] Sin[u], u}, {u, 0,
4 Pi}, PlotRange -> {{-2, 2}, {-2, 2}},
ColorFunction -> Function[{x, y, z, u}, Hue[u]],
PlotStyle -> Thick,
Axes -> False,
SphericalRegion -> True, RotationAction -> Clip,
ImageSize -> 350,
Boxed -> False,
BoxRatios -> {1, 1, 1}]}],
Style["Custom Dynamics", 16]]
]
--
David Park
djm...@comcast.net
http://home.comcast.net/~djmpark/
"KB" <Kenneth...@gmail.com> wrote in message
news:gccheo$s5t$1...@smc.vnet.net...