Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #2239
| From | "E. Martin-Serrano" <eMartinSerrano@telefonica.net> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Can't use Table with Dynamic variables? |
| Date | 2011-05-09 11:38 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <iq8jnc$72i$1@smc.vnet.net> (permalink) |
Try applying the Dynamic[] wrapper to each element in the table (inside the
table construct not outside). I experienced the same problem in several
occasions and solved it in this form. Anyway the movement of the dragged
objects is sluggish, just in the border of which could be considered as
acceptable despite that just four or the five locators in the involved
construct does not seem to be a heavy demand.
-----Mensaje original-----
De: Christopher O. Young [mailto:cy56@comcast.net]
Enviado el: lunes, 09 de mayo de 2011 12:18
Para: mathgroup@smc.vnet.net
Asunto: Can't use Table with Dynamic variables?
By following the advice in the helpful free PDF tutorial
"DynamicInteractivity", I used With to pull out the iterator for the Table
from the enclosing Dynamic expression.
Finally got the 3D points moving around under the control of the 2D locators
and the height sliders. I have the Bezier curves, but I can't get the
interpolating curve to work with Graphics and Dynamic yet.
Also, if you're not careful, when you try to drag a locator, the whole 2D
graphing pane gets dragged around instead. What's causing this?
P = {{1, 0}, {1, 1}, {2, 2}, {3, 3}}
GraphicsGrid[
{
{
"Z-coordinate",
"Radius"
},
{
Slider[Dynamic[h], {-2, 2, 0.25}, Appearance -> "Labeled"],
Slider[Dynamic[r], {0, 1, 0.01}, Appearance -> "Labeled"]
},
{
Graphics[
{
Dynamic[
Table[
With[{k = k},
Locator[Dynamic[P[[k]]]]
],
{k, 1, 4}
]
],
Dynamic[
BezierCurve[{P[[1]], P[[2]], P[[3]], P[[4]]}]
]
},
PlotRange -> 5,
Frame -> True,
Axes -> True
],
Dynamic[
Graphics3D[
{
Table[
Sphere[{P[[k, 1]], P[[k, 2]], h}, r],
{k, 1, 4}
],
Tube[
BezierCurve[
{{P[[1, 1]], P[[1, 2]], h}, {P[[2, 1]], P[[2, 2]],
h}, {P[[3, 1]], P[[3, 2]], h}, {P[[4, 1]], P[[4, 2]], h}}]
]
},
PlotRange -> 5,
Axes -> True,
ViewPoint -> {10, 5, 8},
ViewVertical -> {0, 1, 0},
AxesLabel -> {"x", "y", "z"}
]
]
}
},
ItemAspectRatio -> {0.025, 0.04, 1},
Dividers -> {All, {True, False, True, True}}, Spacings -> {25, 20} ]
Dynamic[
Plot[
Interpolation[{P[[1]], P[[2]], P[[3]], P[[4]]}][x],
{x, P[[1, 1]], P[[4, 1]]}
]
]
Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Can't use Table with Dynamic variables? "E. Martin-Serrano" <eMartinSerrano@telefonica.net> - 2011-05-09 11:38 +0000 Re: Can't use Table with Dynamic variables? "Christopher O. Young" <cy56@comcast.net> - 2011-05-10 12:53 +0000
csiph-web