Find Coordinates of Intersection Between Hypotenuse of Right Triangle and Circle

analytic geometrygraphing-functionstrianglestrigonometry

Example 1: Big Triangle Intersecting Circle

Example 2: Small Triangle Intersecting Circle

1.
I am trying to get the coordinates of an intersection between a hypotenuse of a right triangle and a circle. I need an algorithm or equation that can give me the intersection coordinates using the radius of the circle and length of the 2 sides of the right triangle. I am completely stumped, but if I figure out the equation/algorithm I need, I will share it here.

2.
It is very difficult to explain exactly what I need so I have provided 2 pictures as examples. I need to find the equation/algorithm for both of these examples.

The 1st example shows a triangle that is bigger than the circle and intersects the circle. I need the coordinates for the intersection of the hypotenuse and the circle. Radius of the circle is 1. Sides of the triangle are 2 and 3.

The 2nd example shows a triangle that is smaller than the circle and I have drawn a dashed line that intersects with the circle. I need the coordinates for the intersection of the dashed line and the circle. Radius of the circle is 1. Sides of the triangle are 0.4 and 0.2.

3.
Below is unnecessary information that describes the project I'm working on that requires this solution:

I am trying to generate a common x,y value for an angle from a center point. The only values I can get are the x and y distance between point A and point B. This is for a game I'm developing. I am trying to add a force that has to be expressed as x,y values. The issue is that the magnitude is inversely proportional to distance, with exponential loss of force over distance. I basically need the common x,y coordinates, then I can apply the magnitude that I already have calculated. This is the best way I've come up with for solving this issue.

THANKS FOR ANY AND ALL HELP! ITS GREATLY APPRECIATED! i wish i paid more attention in school XD

EDIT:

Thanks to A-Level Student, I was able to get the equations I need for the intersection. These equations apply to both example 1 and 2.

$x_2$ = x of intercept, $y_2$ = y of intercept, $x_1$ = side width of triangle, $y_1$ = side length of triangle

Get X of the intercept with the following:

$$x_2 = \sqrt{1 \div ((\frac{y_1}{x_1})^2 + 1)}$$

Get Y of the intercept with the following:

$$y_2 = \sqrt{1 \div ((\frac{x_1}{y_1})^2 + 1)}$$

Please note that these equations only work for a circle with a radius of 1, since $x^2 + y^2 = r^2$.

Also, I would like to note that this formula was used in Unity (C# scripts) to essentially apply a force to a 2D object opposite to where a location was pressed on the screen, relative to the distance between the object and the touched position. (You can think of this as a 2D force that is applied to an object by a blast wave of a bomb. Essentially what I'm doing.) Also, this will only ever return positive values, so I had to add a conditional statement to apply the correct negative values. The if statement looks something like this: if (x_1 > 0) { //perform x_2 equation multiplied by negative-1}, and same for y_1 and also some logic for if x_1 or y_1 is equal to 0, so you don't get a null value. But everything worked. Hope this helps anyone else who comes across this problem as I did.

Best Answer

Begin by finding the equations for each relevant curve and solving the simultaneous equations.

Question 1

The circle has equation $$x^2+y^2=1$$ and the equation of the line that the hypotenuse is part of is $$y=\frac{3}{2}x$$ Hence, $$x^2+\left(\frac{3}{2}x\right)^2=1\implies \frac{13}{4}x^2=1$$ so $$x^2=\frac{4}{13}$$ Can you solve it from there? Watch out though: this equation gives you two solutions, but you are only interested in one of them.

Question 2

The circle has equation $$x^2+y^2=1$$ and the line that includes the hypotenuse has equation $$y=0.5x$$ Again, try solving these simultaneous equations.


If you need any more help please don't hesitate to ask :)