Re: Can a Locator be Made to Track a Curve?
- To: mathgroup at smc.vnet.net
- Subject: [mg120724] Re: Can a Locator be Made to Track a Curve?
- From: "Oleksandr Rasputinov" <oleksandr_rasputinov at hmamail.com>
- Date: Sun, 7 Aug 2011 06:16:25 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <j1im6k$co2$1@smc.vnet.net>
On Sat, 06 Aug 2011 07:15:48 +0100, Gregory Lypny
<gregory.lypny at videotron.ca> wrote:
> Hello everyone,
>
> Can a locator be constrained so that it tracks a curve?
>
> Regards,
>
> Gregory
>
Yes:
f = Sin;
DynamicModule[{p = {0, f[0]}},
Show[{
Plot[f[x], {x, -Pi, Pi}],
Graphics@
Locator@Dynamic[
p, (p = Through@{First, Composition[f, First]}@#) &]
}]
]