Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8067 > unrolled thread

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

Started byChris Young <cy56@comcast.net>
First post2012-01-21 10:12 +0000
Last post2012-01-23 08:00 +0000
Articles 4 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  DynamicModule to set locations of 3D points from 2D LocatorPane? Chris Young <cy56@comcast.net> - 2012-01-21 10:12 +0000
    Re: DynamicModule to set locations of 3D points from 2D LocatorPane? "Nasser M. Abbasi" <nma@12000.org> - 2012-01-22 12:30 +0000
    Re: DynamicModule to set locations of 3D points from 2D LocatorPane? David Reiss <dbreiss@gmail.com> - 2012-01-22 12:31 +0000
      Re: DynamicModule to set locations of 3D points from 2D LocatorPane? Chris Young <cy56@comcast.net> - 2012-01-23 08:00 +0000

#8067 — DynamicModule to set locations of 3D points from 2D LocatorPane?

FromChris Young <cy56@comcast.net>
Date2012-01-21 10:12 +0000
SubjectDynamicModule to set locations of 3D points from 2D LocatorPane?
Message-ID<jfe32d$9pa$1@smc.vnet.net>
I don't see why the following doesn't update the 3D points. They just 
stay stuck at the initialized x and y coordinates.


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

 {
  LocatorPane[
   Dynamic[pt],
   P = Append[#, 0] & /@  pt;
   Framed @ Graphics[{}, Axes -> True]
   ],

  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]
  }
 ]

[toc] | [next] | [standalone]


#8089

From"Nasser M. Abbasi" <nma@12000.org>
Date2012-01-22 12:30 +0000
Message-ID<jfgvgp$pl3$1@smc.vnet.net>
In reply to#8067
On 1/21/2012 4:12 AM, Chris Young wrote:
> I don't see why the following doesn't update the 3D points. They just
> stay stuck at the initialized x and y coordinates.
>
>
> DynamicModule[
>   {pt = 1/2 {{1, 1}, {-1, 1}, {1, -1}},
>    P},
>
>   {
>    LocatorPane[
>     Dynamic[pt],
>     P = Append[#, 0]&  /@  pt;
>     Framed @ Graphics[{}, Axes ->  True]
>     ],
>
>    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]
>    }
>   ]
>
>

Please try this to see if it works for you.

------------------
DynamicModule[{pt = 1/2 {{1, 1}, {-1, 1}, {1, -1}}, p},
  
  Grid[{
    {
     Dynamic@LocatorPane[Dynamic@pt,
       p = Append[#, 0] & /@ pt;
       Framed@Graphics[{}, Axes -> True]
       ],
     Graphics3D[{Sphere[p, 0.05], {Opacity[0.5], Tube[Line[p], 0.03]},
       Tube[BezierCurve[p], .03]}, Axes -> True, PlotRange -> 1]
     }
    }]
  ]
----------------------

--Nasser

[toc] | [prev] | [next] | [standalone]


#8091

FromDavid Reiss <dbreiss@gmail.com>
Date2012-01-22 12:31 +0000
Message-ID<jfgvim$pln$1@smc.vnet.net>
In reply to#8067
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]}]



--David


On Jan 21, 5:12 am, Chris Young <c...@comcast.net> wrote:
> I don't see why the following doesn't update the 3D points. They just
> stay stuck at the initialized x and y coordinates.
>
> DynamicModule[
>  {pt = 1/2 {{1, 1}, {-1, 1}, {1, -1}},
>   P},
>
>  {
>   LocatorPane[
>    Dynamic[pt],
>    P = Append[#, 0] & /@  pt;
>    Framed @ Graphics[{}, Axes -> True]
>    ],
>
>   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]
>   }
>  ]

[toc] | [prev] | [next] | [standalone]


#8116

FromChris Young <cy56@comcast.net>
Date2012-01-23 08:00 +0000
Message-ID<jfj43d$7di$1@smc.vnet.net>
In reply to#8091
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.


[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web