## Interactive angles

2

The following is nearly what I am after, but the angles don't behave quite as I'd like:

r[a_, b_] := RegionNearest[Circle[{0, 0}, 1], a[[b]]];
Manipulate[Graphics[{Circle[{0, 0}, 1],
Line /@ {{Join[{{0, 0}}, a, {{0, 0}}]}},
Circle[{0, 0}, 1/4, {
If[a[[3, 2]] < 0, -#, #] &@VectorAngle[{1, 0}, a[[3]]],
If[a[[1, 2]] < 0, -#, #] &@VectorAngle[{1, 0}, a[[1]]]}],
Circle[a[[2]], 1/4, {
If[a[[3, 2]] - 1 < 0, -#, #] &@ VectorAngle[{1, 0}, {0, -1} + a[[3]]],
If[a[[1, 2]] - 1 < 0, -#, #] &@ VectorAngle[{1, 0}, {0, -1} + a[[1]]]}]
}, PlotRange -> 1.1],
{{a, CirclePoints[3]}, Locator,
TrackingFunction -> (Switch[CurrentValue["CurrentLocatorPaneThumb"],
1, a[[1]] = r[#, 1],
2, a[[2]] = r[#, 2],
3, a[[3]] = r[#, 3]
] &), Appearance -> None}]


Is there a more straightforward way to go about this, or is VectorAngle the simplest?

Huh? What are you trying to accomplish? – David G. Stork – 2017-11-22T16:22:46.867

@DavidG.Stork I'm trying to get the angles to move with the points - dragging the top angle is not right (remove Appearance -> None to show locators). – martin – 2017-11-22T19:33:14.050

4

Does this approximate what you want? It is not the most efficient. Since you're always referencing to {1,0} with VectorAngle, why not just use ArcTan. I used a couple of helper functions from messing with circular arcs for Indra's Pearls.

r[a_, b_] := RegionNearest[Circle[{0, 0}, 1], a[[b]]];

ang[p_, q_] :=
Block[{a, b},
If[(a = N[ArcTan @@ p]) < 0, a = a + 2 Pi];
If[(b = N[ArcTan @@ q]) < 0, b = b + 2 Pi];
If[b < a, {a, b + 2 Pi}, {a, b}]]

ang1[p_, q_] :=
Block[{a, b},
If[(a = N[ArcTan @@ p]) < 0, a = a + 2 Pi];
If[(b = N[ArcTan @@ q]) < 0, b = b + 2 Pi];
{a, b} = Sort[{a, b}];
If[b - a > Pi, {b, a + 2 Pi}, {a, b}]]

Manipulate[
Graphics[{Thick,
Circle[{0, 0}, 1],
Line /@ {{Join[{{0, 0}}, a, {{0, 0}}]}}, Blue,
Circle[{0, 0}, 1/4, ang[a[[1]], a[[3]]]], Red,
Circle[a[[2]], 1/8, ang1[a[[1]] - a[[2]], a[[3]] - a[[2]]]]},
PlotRange -> 1.1], {{a, CirclePoints[3]}, Locator,
TrackingFunction -> (Switch[CurrentValue["CurrentLocatorPaneThumb"],
1, a[[1]] = r[#, 1],
2, a[[2]] = r[#, 2],
3, a[[3]] = r[#, 3]] &), Appearance -> None}]


very nice! Thank you! – martin – 2017-11-22T22:17:01.130

slight anomoly moving top angle (red) about {0,1} - unsure how to fix? – martin – 2017-11-22T22:33:36.447

Not sure what you mean. One problem occurs when two points are very close to the red arc. In this case, the arc can be too large. That is why I reduced its radius from your 1/4 to 1/8. – KennyColnago – 2017-11-23T02:58:20.453

My mistake - yes - it works better at 1/8! – martin – 2017-11-23T11:08:43.503