MathGroup Archive 2010

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

Search the Archive

Re: Locator Manipulate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113420] Re: Locator Manipulate
  • From: roby <roby.nowak at gmail.com>
  • Date: Wed, 27 Oct 2010 05:34:33 -0400 (EDT)
  • References: <i9jq3k$ohm$1@smc.vnet.net> <i9p6pd$onu$1@smc.vnet.net>

On 21 Okt., 13:05, Fred Klingener <gigabitbuc... at BrockEng.com> wrote:
> On Oct 19, 5:58 am, roby <roby.no... at gmail.com> wrote:
>
>
>
> > Dear all !
>
> > I am trying (hard) to use an individual Locator inside Manipulate.
>
> > While the plain version works:
>
> > Manipulate[Graphics[Circle[{0, 0}, 10]],
> > {{p, {0, 0}}, Locator}]
>
> > The individual version restricts the movement to {{0,0},{1,1}}, any
> > hints ?
>
> > Manipulate[Graphics[Circle[{0, 0}, 10]],
> > {{p1, {0, 0}}, Locator[#] &, ControlType -> Locator}]
>
> > Regards Robert
>
> (* This sets Locator limits to the graphics extent: *)
>
> Manipulate[
>  Column[{
>    Dynamic[p1]
>    , Graphics[Circle[{0, 0}, 10]]
>    }]
>  , {{p1, {0, 0}}
>   , {-10, -10}
>   , {+10, +10}
>   , Locator[#] &
>   , ControlType -> Locator}
>  ]
>
> (* This is a way to constrain the Locator inside the Circle
> (after you get it running, you probably want to turn off the
> original Locator graphic with an Appearance->None) *)
>
> Manipulate[
>  DynamicModule[{p2 = If[Norm[p1] > 10, 10 p1/Norm[p1], p1]}
>   , Column[{
>     Dynamic[p1]
>     , Dynamic[p2]
>     , Graphics[{
>       Circle[{0, 0}, 10]
>       , Red
>       , Disk[p2, 0.5]
>       }]
>     }]
>   ]
>  , {{p1, {10, 0}}
>   , {-10, -10}
>   , {+10, +10}
>
>   , ControlType -> Locator}
>  ]
>
> (* and this is a way to constrain the Locator to run on the Circle
> itself. *)
>
> Manipulate[
>  DynamicModule[{p2 = 10 p1/Norm[p1]}
>   , Column[{
>     Dynamic[p1]
>     , Dynamic[p2]
>     , Graphics[{
>       Circle[{0, 0}, 10]
>       , Red
>       , Disk[p2, 0.5]
>       }]
>     }]
>   ]
>  , {{p1, {10, 0}}
>   , {-10, -10}
>   , {+10, +10}
>
>   , ControlType -> Locator}
>  ]
>
> Hth,
> Fred Klingener



Hi Fred,

thank you for your effort.

According to your first example:

Manipulate[
 Column[{
   Dynamic[p1]
   , Graphics[Circle[{0, 0}, 10]]
   }]
 , {{p1, {0, 0}}
  , {-10, -10}
  , {+10, +10}
  , Locator[#] &
  , ControlType -> Locator}
 ]

When I replace the line  Locator[#]& by e.g. Foo[#]& the functionality
does not change at all.
It seems that the anonymous functions Locator[#]& respectivly  Foo[#]&
are not called by Mathematica at all.

to your other examples:

... This is a way to constrain the Locator inside the Circle ...

this is not realy true only your Red Disc[] is constrained.

What I realy need would be a (2D) Locator[ ] and 2 additional
Slider[ ] one for x and one for y.
Then I would like to control the same Locator either by the Locator[ ]
or by the Slider[ ], of coures both Sliders as well as the Locoator
should move syncronously.

Regards Robert





  • Prev by Date: Re: How to find the eigenvalues/eigenfunctions of a
  • Next by Date: Re: discrete points in 3D polar
  • Previous by thread: Re: Locator Manipulate
  • Next by thread: Tree with repeated labels