# Dynamic Graphic with a goniometric circumference, angle and tangent

I would like to make a circle with radius 1 with axeses showed.

I would like to dynamically select a point on the circle, draw a line from that point to the center and draw the tangent line to that point.

Should I use a ParametricPlot[] in some way?

Is it possible to make that, dynamic moving the point with the mouse or a slider is needed?

This version is virtually identical to J.M.'s fine answer. It uses Manipulate rather than DynamicModule.

## Update

Edited as per suggestion from Michael E2 to use TrackingFunction which eliminates the use of Dynamic entirely (neglecting the fact that the first argument of Manipulate is internally wrapped in a Dynamic).

A locator with the point initialized to lie on the circle at a 45 degree angle is used as the Manipulator control. Further the position of the point is constrained to lie on the circle using TrackingFunction.

Manipulate[

Graphics[{
{Blue, Circle[]},
{Dashed, Line[{{0, 0}, pt}]},
{Red, InfiniteLine[pt, Cross[pt]]}
},
Axes -> True,
PlotRange -> 3/2
],

{{pt, {1, 1}/Sqrt[2]}, Locator,
TrackingFunction -> ((pt = Normalize[#]) &)}
]


• If I was going to use Manipulate, I would take advantage of its features, like automatic construction of Locator controls and TrackingFunction: Manipulate[Graphics[{{Blue, Circle[]}, {Dashed, Line[{{0, 0}, pt}]}, {Red, InfiniteLine[pt, Cross[pt]]}}, Axes -> True, PlotRange -> 3/2], {{pt, {1, 1}/Sqrt[2]}, Locator, TrackingFunction -> ((pt = Normalize[#]) &)}] – Michael E2 May 11 '17 at 12:52
• @MichaelE2 Good suggestion (I have been fairly ignorant of TrackingFunction). Modified answer as per your suggestion. – Jack LaVigne May 11 '17 at 13:06
• @JackLaVigne Perfect, thank you. If I would like also to draw segment from the point to the axes, what should I add? – Ale1794 May 11 '17 at 20:50
• @Ale1794 Look up Line and Part, e.g. pt[[1]] and pt[[2]]. – Michael E2 May 11 '17 at 22:26
• @Ale1794 Add these lines to the list enclosed by Graphics. {RGBColor[0, 0.7, 0], Line[{{pt[[1]], 0}, pt}]}, {Magenta, Line[{{0, pt[[2]]}, pt}]}. – Jack LaVigne May 12 '17 at 13:51

Here's a simple version:

DynamicModule[{pt = {1, 1}/Sqrt[2]},
LocatorPane[Dynamic[pt, (pt = Normalize[#]) &],
Graphics[{{Blue, Circle[]},
{Dashed, Line[{{0, 0}, Dynamic[pt]}]},
{Red, InfiniteLine[Dynamic[pt], Dynamic[Cross[pt]]]}},
Axes -> True, PlotRange -> 3/2]]]


I'll leave the fancy styling up to you.