Find Slope Of Line Drawing A Circle

463 Views Asked by At

I am programming a semi-circle (and it can also be a circle) that animates to full and empty like so:

enter image description here

enter image description here

I am having a hard time calculating is the slant on the line. What I would like to do is have a bold line drawn that follows the tip of the circle and adapts to it curve like so:

enter image description here

I have done research on finding the point on a circle at any given angle. What I am struggling with is how to find the slope of the line at that point.

Can you suggest how I might calculate the slope of a line at a point in the circle?

Update

Slope was correct and as suggested by @S.C.B.

And the suggestion by @HenningMakholm lead me to the final solution. I originally asked about the slope and the answer provided is correct. Ultimately I wanted to draw a line along the slope and using an inner and outer radius to find the inner and outer points was the solution that worked best.

enter image description here enter image description here

1

There are 1 best solutions below

1
On BEST ANSWER

If you're trying to find the slope of the bold line, it's quite simple. Because your bold line will form a right angle with the tangent line at that point, it must pass through the center.

So, what you are looking for is just the slope of the line that passes through the center and a point on a circle.

In essence, if the center of the circle is the origin of the $xy$-plane then we can conclude that the slope will be $\frac{y}{x}$.