Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #2219
| From | "Christopher O. Young" <cy56@comcast.net> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Can't use Table with Dynamic variables? |
| Date | 2011-05-09 10:18 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <iq8f1a$5qq$1@smc.vnet.net> (permalink) |
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 | Find similar | Unroll thread
Can't use Table with Dynamic variables? "Christopher O. Young" <cy56@comcast.net> - 2011-05-09 10:18 +0000
csiph-web