Re: Mapping a curve to a surface using Manipulate

*To*: mathgroup at smc.vnet.net*Subject*: [mg124639] Re: Mapping a curve to a surface using Manipulate*From*: John Fultz <jfultz at wolfram.com>*Date*: Fri, 27 Jan 2012 06:14:37 -0500 (EST)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Reply-to*: jfultz at wolfram.com

On Thu, 26 Jan 2012 04:59:46 -0500, Christopher Young wrote: > Thanks very much, that allows me to rotate the 3D graph and resize it, > without the clicks being captured by the LocatorPane. It looks like the > problem of the clicks getting captured was due to their being two sets of > locators, one created by the LocatorPane declaration, and the other by > the manipulate listing of points. Taking out the "Locator" and replacing > it with "None" fixed this. > > It's interesting to remove each Dynamic call one at a time and to see the > effect. Everything basically works if I just remove the Dynamic wrapper > for the 3D plotting. The only problem is that dragging will only go a > little way at a time. This is because, without that Dynamic, the entire contents of the Manipulate will be recreated, including the LocatorPane you're dragging in. Although, in this case, it should be theoretically possible for Mathematica to keep track of Locators even through the re-creation of a LocatorPane, there are still some cases that fail. > Everything is vastly slowed down. Can this be > understood as the Manipulator sending many more events to the > Show[ParametricPlot3D[...]] unless the Dynamic is applied to "fence it > off"? No, this is more about the non-responsiveness of that LocatorPane (at least I'm pretty sure it is...I haven't done a detailed analysis of your problem, but I do understand the system very well and I think I'm correct here). It's not being slowed down in the traditional sense of slurping lots more of your CPU. Instead the LocatorPane is just not doing a very good job of tracking your mouse movements through its re-creation. This wouldn't be a problem with LocatorPanes generated by Manipulate because Manipulate makes sure that LocatorPane sits outside the outermost Dynamic, but since we want a LocatorPane which only covers a portion of the Manipulate's content area, we're forced to think about all of this explicitly. Sincerely, John Fultz jfultz at wolfram.com User Interface Group Wolfram Research, Inc. > > > At any rate, working through these examples with this kind of assistance > is a big help. > > > Chris > > > On Jan 25, 2012, at 10:11 AM, John Fultz wrote: > >> The Manipulate Locator control always creates a LocatorPane that covers >> the >> entire Manipulate contents. If you want different behavior, you'll >> have to >> introduce your own LocatorPane to the Manipulate. However, you don't >> want to >> run into problems we've discussed previously with controls being >> recreated >> inside of a Dynamic (in this case, the implicit Dynamic introduced by >> Manipulate) as you're using them. So, a couple of strategically placed >> Dynamics >> to prevent this are necessary as well. See if this works for you: >> >> Manipulate[ >> Grid[{{LocatorPane[Dynamic[P], >> Dynamic@Show[ >> ParametricPlot[\[HorizontalLine]Bez[P, t], {t, 0, 1}], >> Graphics@{Dotted, Line[P]}, PlotRange -> 2, Axes -> True]], >> Dynamic@Show[ >> ParametricPlot3D[{u, v, u v}, {u, -2, 2}, {v, -2, 2}, >> PlotRange -> 2, Mesh -> False], >> ParametricPlot3D[{\[HorizontalLine]Bez[P, >> t][[1]], \[HorizontalLine]Bez[P, >> t][[2]], \[HorizontalLine]Bez[P, >> t][[1]] \[HorizontalLine]Bez[P, t][[2]]}, {t, 0, 1}, >> PlotRange -> 2] /. >> Line[pts_, rest___] :> >> Tube[pts, 0.05, rest]]}}], {{P, {{-1, -1}, {-1, -.5}, {-1, >> 0}, {-1, .5}, {-1, 1}, {1, -1}, {1, -.5}, {1, 0}, {1, .5}, {1, >> 1}}}, None}, {{n, 10}, 0, 50, 1}]