Hello. I am trying to make an interface for 'polygon refinenment'. My starting point is this from the Locator documentation:
DynamicModule[{p = {0.5, 0.5}}, {Graphics[Locator[Dynamic[p]],
PlotRange -> 2], Dynamic[p]}]
Here is an example polygon
poly1 = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
My first thought is
DynamicModule[{p1 = poly1}, {Graphics[Map[Locator,Dynamic[p1]]], Dynamic[p1]}]
But this fails with the message "Coordinate {{0, 0}, {1, 0}, {1, 1}, {0, 1}} should be a pair of numbers, or a Scaled or Offset form." If I get rid of the Dynamic, there is no error.
DynamicModule[{p1 = poly1}, {Graphics[Map[Locator, p1],
PlotRange -> 2], Dynamic[p1]}]
and I get four locators that I can move, but of course p1 is now not updated.
Can anyone see how to make a set of locators that update p1? I am wondering if I will have to programmatically create a list of named vertices, and make them all individually Dynamic.
Gareth