5
$\begingroup$

Mathematica seems to support no "rotation slider" Control which might be used, for instance, in setting an angular direction ($0 \leq \theta \leq 2 \pi$) on a plane. I couldn't find one in the documentation. One can constrain a Slider2D to have a unit length, so that the resulting slider performs as I need, but that seems kludgy and the interface inelegant and non-obvious.

Is there any code creating what we might call a SliderAngle or equivalent, with nice graphics that can be scaled, colored, and such? We should be able to "wind up" the control... that is continually increase the angle clockwise or counterclockwise through multiple revolutions.

$\endgroup$
7
  • $\begingroup$ Experimental`AngularSlider? $\endgroup$
    – kglr
    Commented Jan 26 at 7:39
  • $\begingroup$ try NotebookTools`AngularSliderTest[] to play with features of Experimental`AngularSlider $\endgroup$
    – kglr
    Commented Jan 26 at 7:46
  • 1
    $\begingroup$ There is a CircularWinder in the Function Repository. $\endgroup$
    – LouisB
    Commented Jan 26 at 7:57
  • 1
    $\begingroup$ Oh... hadn't seen that. Thanks. But I don't see how to use this as a genuine Control (like a Slider or Slider2D). Can you post a minimal Manipulate that rotates a vector using this new slider? Regardless, my recommendation to WRI: incorporate such a true Control into the next release—it would be very useful. $\endgroup$ Commented Jan 26 at 7:57

1 Answer 1

7
$\begingroup$
Manipulate[
 ParametricPlot[{Cos[x], Sin[3  x]}, {x, 0, 5 Pi}, 
  MeshFunctions -> {#3 &}, 
  Mesh -> {{Abs @ z}},
  PlotLabel -> z, 
  MeshStyle -> Directive[Red, AbsolutePointSize @ 15]], 
{{z, Pi/4}, Experimental`AngularSlider[#] &}]

enter image description here

Manipulate[
 ParametricPlot[{Cos[x], Sin[3  x]}, {x, 0, 5 Pi}, 
  MeshFunctions -> {#3 &}, 
  Mesh -> {{Abs@z}}, 
  PlotLabel -> Style[Round[z, Pi/32], 16], 
  MeshStyle -> Directive[Red, AbsolutePointSize@15]], 
{{z, Pi/4}, 
  Experimental`AngularSlider[#, 
    Appearance -> Dynamic @ Graphics @
       Text[Style[Round[z, Pi/32], 16], {0, 0}, {0, -1.1},  
          - Cross @ {Cos @ z, Sin @ z}], 
    FrameMargins -> 30] &}]

enter image description here

NotebookTools`AngularSliderTest[]

enter image description here

Options[Experimental`AngularSlider] // Column

enter image description here

$\endgroup$
1
  • $\begingroup$ Alright! I'd expect nothing less from the legendary kglr. Thanks! ($+1$,$\checkmark$) $\endgroup$ Commented Jan 26 at 8:24

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.