2
$\begingroup$

What this example code from https://reference.wolfram.com/language/ref/Dynamic.html (under Applications section the first example) should teach us?

 (* Constrain the coordinates of a point to lie on a circle: *)

 DynamicModule[{p = {0, 1}}, 
 Graphics[{Dashed, Circle[], PointSize[0.1], 
   Point[Dynamic[p, (p = Normalize[#]) &]]}, ImageSize -> Tiny, 
  PlotRange -> 1.2]]

enter image description here

I see nothing dynamic on the output. Even when I use p = {0, 1/2} instead of p = {0, 1} the point does not lie on the circle (no normalization of point p occur).

$\endgroup$
4
  • 3
    $\begingroup$ If you enter the above and then double click (and then drag the black dot around), it moves, constrained to the circle. $\endgroup$
    – bill s
    Commented Dec 3, 2022 at 18:30
  • $\begingroup$ This is really unexpected. They should have mention it in the description - i.e. what to do to test it. $\endgroup$ Commented Dec 3, 2022 at 18:34
  • $\begingroup$ It's a graphic object -- one way to interact with a graphics objects is use the mouse. But surely you are correct that it would be better to explain it! $\endgroup$
    – bill s
    Commented Dec 3, 2022 at 18:38
  • $\begingroup$ I thought double clicking on static 2D was meant only for manually editing it. Unlike when using on 3D graphics to rotate scene. $\endgroup$ Commented Dec 3, 2022 at 18:40

1 Answer 1

1
$\begingroup$

Another example work.

DynamicModule[{pt = {0, 1}}, 
 LocatorPane[Dynamic[pt], 
  Graphics[{Dashed, Circle[], PointSize[Large], 
    Dynamic[Point[Normalize[pt]]]}], Appearance -> None]]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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