Re: Constraining a Location to Move Along a Plot in a
- To: mathgroup at smc.vnet.net
- Subject: [mg127782] Re: Constraining a Location to Move Along a Plot in a
- From: Gregory Lypny <gregory.lypny at videotron.ca>
- Date: Wed, 22 Aug 2012 02:26:20 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
- References: <20120821013043.F31B7684F@smc.vnet.net>
This is so cool. Thank you, Bob.
Gregory
On Tue, Aug 21, 2012, at 10:30 AM, Bob Hanlon <hanlonr357 at gmail.com> wrote:
> Manipulate[
> Module[{f, m, b, xmin = -5, xmax = 5},
> f[x_] :=
> (m*x + b /. Solve[{
> pt1[[2]] == m*pt1[[1]] + b,
> pt2[[2]] == m*pt2[[1]] + b},
> {m, b}][[1]]);
> Graphics[{
> Line[{{xmin, f[xmin]},
> {xmax, f[xmax]}}],
> AbsolutePointSize[8],
> Red,
> Tooltip[Point[{x, f[x]}], {x, f[x]}],
> Blue,
> Tooltip[Point[
> {InverseFunction[f][y], y}],
> {InverseFunction[f][y], y}]},
> Frame -> True, Axes -> False,
> PlotRange -> {{xmin, xmax}, {-5, 5}}]],
> {{x, -1, Style["x", Red, Bold, 12]}, -5, 5, 0.1,
> Appearance -> "Labeled"},
> {{y, 1, Style["y", Blue, Bold, 12]}, -5, 5, 0.1,
> Appearance -> "Labeled"},
> {{pt1, {-4, -4}}, Locator},
> {{pt2, {4, 4}}, Locator}]
>
>
> Bob Hanlon
>
- References:
- Constraining a Location to Move Along a Plot in a Manipulate
- From: Gregory Lypny <gregory.lypny@videotron.ca>
- Constraining a Location to Move Along a Plot in a Manipulate