Constraining locators on a dynamically updated object
- To: mathgroup at smc.vnet.net
- Subject: [mg127405] Constraining locators on a dynamically updated object
- From: Brentt <brenttnewman at gmail.com>
- Date: Sun, 22 Jul 2012 04:33:26 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
Hello,
I was having an issue with dynamic that I can't seem to puzzle out. I have
two locators constrained on a circle. I want at least one locator to
control the circle's radius which both are constrained on (it'd be nice if
both did, but one step at a time). My almost working code is this:
DynamicModule[{rad = {1, 0}, pos = {0, 1}},
Graphics[{Circle[{0, 0}, Dynamic[Norm[rad]]], Locator[Dynamic[rad]],
Locator[Dynamic[pos, (pos = Norm[rad] Normalize[#1]) &]]}]
]
It mostly does what I want except, the locator that doesn't control the
circle's radius doesn't keep on the circle until i click on it. What is
going on here?