1
$\begingroup$

I seek advice regarding the constrained behaviour of the Locator: appears confined to square {0,0}->{1,1}. When I change starting position it snaps to this constrained region.

The code I am referring to follows:

Manipulate[
 Module[{cn, d}, cn = {c1, c2, c3}; 
  d = Norm[# - pt] & /@ {c1, c2, c3}; 
  Graphics[{{Black, Point[cn]}, 
    MapThread[{#1, Circle[#2, #3]} &, {{Red, Green, Blue}, cn, d}]}]
  ],
 {pt, {1, 1}, ControlType -> Locator, LocatorRegion -> Full},
 Initialization -> (c1 = {0, 0}; c2 = {3, 0}; c3 = {0, 3};)
 ]

The constraint remains whether I define PlotRange, use EuclideanDistance or otherwise define the distance function.

The following graphic shows (obviously) this is well defined outside the region of constraint of the Locator. Intersection point at {4,4}with fixed points at{0,0}, {1,0}, {0,1}.

enter image description here

Image generated by:

Graphics[{{Black, Point[cc = {{0, 0}, {1, 0}, {0, 1}}]}, {Red, 
   Point[{{4, 4}}]}, Map[Circle[#1, Norm[# - {4, 4}]] &, cc]}]

I can get around the constraint using Slider2D but I am still uncertain about the Locator issue.

Manipulate[
 Module[{cn, d}, cn = {c1, c2, c3}; 
  d = Norm[# - pt] & /@ {c1, c2, c3}; 
  Graphics[{{Black, Point[cn]}, {Red, PointSize[0.02], Point[pt]}, 
    MapThread[{#1, Circle[#2, #3]} &, {{Red, Green, Blue}, cn, d}]}, 
   PlotRange -> {{-5, 5}, {-5, 5}}]
  ],
 {pt, {-4, -4}, {4, 4}, ControlType -> Slider2D},
 Initialization -> (c1 = {0, 0}; c2 = {1, 0}; c3 = {0, 1};)
 ]

Thank you @Nasser I look forward to trying your code.

$\endgroup$
  • $\begingroup$ Thank you @Mr.Wizard, for edit. Makes question more readable. Am sorry it was syntax error/understanding error on specifying Locator. Questioned answered and learned something. Whole point, I guess. $\endgroup$ – ubpdqn Jul 25 '13 at 1:11
3
$\begingroup$

I've have not used Locator for a while. But please try this (I am not sure if this is what you asking about either, but this makes the locator free to move anywhere in the PlotRange given in the Graphics), if this is not what you meant, will delete this

Manipulate[
 Module[{cn = {c1, c2, c3}, d},
  d = Norm[# - pt] & /@ cn;
  Graphics[{
    {Black, Point[cn]},
    MapThread[{#1, Circle[#2, #3]} &, {{Red, Green, Blue}, cn, d}
     ]
    }, PlotRange -> {{-6, 6}, {-6, 6}},
   Axes -> True]
  ],
 {{pt, {1, 1}}, Locator},
 Initialization :> 
  (c1 = {0, 0};
   c2 = {3, 0};
   c3 = {0, 3};
   )
 ]

enter image description here

$\endgroup$
  • $\begingroup$ Thank you @Nasser. If I change the syntax of my the specification of the Locator from {pt,{1,1},Locator...} to {{pt,{1,1},Locator} as in your code it resolves my issue without axes or plot range. A coding misunderstanding by me now resolved. $\endgroup$ – ubpdqn Jul 24 '13 at 7:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.