Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #2926 > unrolled thread
| Started by | Just A Stranger <forpeopleidontknow@gmail.com> |
|---|---|
| First post | 2011-06-04 10:19 +0000 |
| Last post | 2011-06-05 11:04 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Curve Tracking and fetching Locator coordinates Just A Stranger <forpeopleidontknow@gmail.com> - 2011-06-04 10:19 +0000
Re: Curve Tracking and fetching Locator coordinates Armand Tamzarian <mike.honeychurch@gmail.com> - 2011-06-05 11:04 +0000
| From | Just A Stranger <forpeopleidontknow@gmail.com> |
|---|---|
| Date | 2011-06-04 10:19 +0000 |
| Subject | Curve Tracking and fetching Locator coordinates |
| Message-ID | <isd0rs$1mk$1@smc.vnet.net> |
Hello, I'm trying to figure out how to constrain a locator's movement along
a curve, but then fetch the coordinates of the locator to use in a
calculation.
The documentation has an example of a Locator moving along a circle, but
it's strange, because the way they do it using Normalize seems to make it
not clear how to access the coordinates of the locator.
This is the example code from the Locator documentation:
DynamicModule[{pt = {1, 0}},
Graphics[{Circle[], Locator[Dynamic[pt, (pt = Normalize[#]) &]]},
PlotRange -> 2]]
I'm guessing the normalize function is being applied to the locator
position, and turning it into a unit vector (not entirely clear on how that
works in the code though). That has the effect of tracking the locator on a
unit circe But there is no variable for the locator positon. pt is simply a
list of constants {1,0} (although, I don't understand that entirely either,
because it also appears to be set to simply being a Normalize function)
Anyway, if someone could give me a hint as to what is going on in that code
I would much appreciate it (documentation seems sparse on the locator)
Barring that could someone just give me a quick hack for fetching the
locator's coordinates when it is being tracked along a circle (or better yet
if it is being tracked along an arbitrary curve.)?
Admittedly I have a foggy grasp about how Dynamic modules work, I'm able to
do basic stuff, but it starts to get unwieldy if I branch out.
Thank you for any help :)
[toc] | [next] | [standalone]
| From | Armand Tamzarian <mike.honeychurch@gmail.com> |
|---|---|
| Date | 2011-06-05 11:04 +0000 |
| Message-ID | <isfnr0$bsu$1@smc.vnet.net> |
| In reply to | #2926 |
On Jun 4, 8:19 pm, Just A Stranger <forpeopleidontk...@gmail.com>
wrote:
> Hello, I'm trying to figure out how to constrain a locator's movement along
> a curve, but then fetch the coordinates of the locator to use in a
> calculation.
>
> The documentation has an example of a Locator moving along a circle, but
> it's strange, because the way they do it using Normalize seems to make it
> not clear how to access the coordinates of the locator.
>
> This is the example code from the Locator documentation:
>
> DynamicModule[{pt = {1, 0}},
> Graphics[{Circle[], Locator[Dynamic[pt, (pt = Normalize[#]) &]]},
> PlotRange -> 2]]
>
> I'm guessing the normalize function is being applied to the locator
> position, and turning it into a unit vector (not entirely clear on how that
> works in the code though). That has the effect of tracking the locator on a
> unit circe But there is no variable for the locator positon. pt is simply a
> list of constants {1,0} (although, I don't understand that entirely either,
> because it also appears to be set to simply being a Normalize function)
>
> Anyway, if someone could give me a hint as to what is going on in that code
> I would much appreciate it (documentation seems sparse on the locator)
>
> Barring that could someone just give me a quick hack for fetching the
> locator's coordinates when it is being tracked along a circle (or better yet
> if it is being tracked along an arbitrary curve.)?
>
> Admittedly I have a foggy grasp about how Dynamic modules work, I'm able to
> do basic stuff, but it starts to get unwieldy if I branch out.
>
> Thank you for any help :)
If you just want to get the points as you move along the circle then
this will do it:
DynamicModule[{pt = {1, 0}}, {Graphics[{Circle[],
Locator[Dynamic[pt, (pt = Normalize[#]) &]]}, PlotRange -> 2],
Dynamic[pt]}]
Mike
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web