1. ## [SOLVED] Trig Question

I'm working on a programming assignment, and my Trig is not what it used to be...

I know the following. Xpos,yPos,Xorigin,YOrigin, and the Radius of the Circle. However the Origin points are constantly moving. Wondering what the best way to find out x1,y1 and x2,y2 would be.

2. Originally Posted by tomgupper
I'm working on a programming assignment, and my Trig is not what it used to be...

I know the following. Xpos,yPos,Xorigin,YOrigin, and the Radius of the Circle. However the Origin points are constantly moving. Wondering what the best way to find out x1,y1 and x2,y2 would be.

Hello,

I don't know if this is the best way but it will work: see attachment.

The tangent points are placed on the original circle and on a circle with the centre at $\left(\frac{x_P+x_O}{2}, \frac{y_P+y_O}{2} \right)$ and the radius $r = |\overline{MO}|$

You'll get the coordinates of the points in question by calculating the intersection between these 2 circles.

3. Originally Posted by tomgupper
I'm working on a programming assignment, and my Trig is not what it used to be...

I know the following. Xpos,yPos,Xorigin,YOrigin, and the Radius of the Circle. However the Origin points are constantly moving. Wondering what the best way to find out x1,y1 and x2,y2 would be.

Here is one way. May not be the best way.
(By the way, "the best way" solution may not be the best for everybody. My best way may be different from the "common" best way.)

My understanding is that the position coordinates and the radius R remain are fixed, while the origin coordinates change or roam.

Since you always know the coordinates of the immobile position and the mobile origin, and the R, then for any position of the origin
tan(theta) = (Ypos -Yorig)/(Xpos -Xorig)
theta = arctan[(Ypos -Yorig)/(Xpos -Xorig)] ---------(i)
where
theta is the angle of inclination from the horizontal of the line connecting the Position point and Origin point.

In the posted figure, if you draw right triangles from the ends of the diameter 2R with the Position point, such that the legs are horizontal or vertical, then these two right triangles are equal or congruent.
The hypotenuse of eact right triangle is R.

Case (a)--- If the two right triangles are on the same side of the diameter 2R, and they are to the right of the diameter, then angle alpha is the angle opening downward for both triangle.

Case (b)--- If the two triangles are on opposite sides of the diameter 2R, the angle alpha is the angle at the ends of the diameter.

ange alpha = angle theta.

The "diameter 2R" is the diameter defined by (x1,y1) and (x2,y2) in your posted drawing.

----------------------------------
If you use the two right triangles as described in either of the Cases (a) or (b) above,

In that posted drawing,
x1 = Xpos -R*sin(theta)
y1 = Ypos +R*cos(theta)

x2 = Xpos +R*sin(theta)
y2 = Ypos -R*cos(theta)

That is it.