Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: DynamicModule to set locations of 3D points from 2D LocatorPane?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124539] Re: DynamicModule to set locations of 3D points from 2D LocatorPane?
  • From: Chris Young <cy56 at comcast.net>
  • Date: Mon, 23 Jan 2012 02:59:05 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jfe32d$9pa$1@smc.vnet.net> <jfgvim$pln$1@smc.vnet.net>

On 2012-01-22 12:31:18 +0000, David Reiss said:

> In your DynamicModule, P is not being dynamically updated anywhere,
> nor is the 3D graphic.  Try this as a possibility that works:
> 
> DynamicModule[{pt = 1/2 {{1, 1}, {-1, 1}, {1, -1}}, P},
> 
>  {LocatorPane[Dynamic[pt],
>    Framed@Graphics[{}, Axes -> True]],
> 
> 
>   Dynamic[
>    P = Append[#, 0] & /@ pt;
>    Graphics3D[{Sphere[P, 0.05], {Opacity[0.5], Tube[Line[P], 0.03]},
>      Tube[BezierCurve[P], .03]}, Axes -> True, PlotRange -> 1]
>    ],
> 
>   Dynamic[pt], Dynamic[P]}]

Thanks, I corrected this. I think it's still going to seem like black 
magic for quite a while, exactly where to put the "Dynamic" calls. If 
you put them right next to the assignment to P and all the uses of P, 
that doesn't work, although I can't see any logical reason for that.

DynamicModule[
 {pt = 1/2 {{1, 1}, {-1, 1}, {1, -1}}, P},

 {
  LocatorPane[
   Dynamic @ pt,
   Framed @
    Graphics[
     {},
     Axes -> True]
   ],

  Dynamic @ (P = Append[#, 0] & /@ pt);

  Graphics3D[
   {
    Sphere[Dynamic @ P, 0.05],

    Opacity[0.5],
    Tube[Line[Dynamic @ P], 0.03],
    Tube[BezierCurve[Dynamic @ P], .03]
    },

   Axes -> True,
   PlotRange -> 1
   ],

  Dynamic @ pt,
  Dynamic @ P
  }
 ]

Wish the documentation had some more involved examples than sliders. 
Something involving interconnecting 2D and 3D points would be more 
helpful, IMO. I've been over "Intro to Dynamic" and "Advanced Dynamic" 
many times, but it's hard to tie the examples with sliders to something 
like this.





  • Prev by Date: Error(?) in FormatValues[MakeExpression]
  • Next by Date: Re: Slow plotting of reflected parametric "butterflies"
  • Previous by thread: Re: DynamicModule to set locations of 3D points from 2D LocatorPane?
  • Next by thread: MatrixFormWrapper vs. MatrixForm