# Get intersecting point of Arc, X distance from centre (Unity)

I'm no mathmetician so forgive my wording when I ask this, there is no doubt an answer somewhere but I dont even know what to search for. I want to find the intersection point (B) as a Vector2 on a perfect circle.

If I know X, Y, A and C I assume I can use the radius and distance to calulate the position of B based on the distance between X and C somehow? (using C# if there are any methods which will accomplish this)

TIA.

• Is the distance YX the same as XA? Do X and A always have the same y value (are they both at the same height)? – Leo Mar 6 '18 at 16:04
• Yes, someone informed me I can use Pythagoras, seems simple now! – Col.Cook Mar 6 '18 at 16:21
• I have been trying to write an answer but I'm terrible at explaining trigonometry using English :) – Leo Mar 6 '18 at 16:25
• Me too, I think just saying Pythagoras is enough to lead to the right direction, I put my code below – Col.Cook Mar 6 '18 at 16:26

## 1 Answer

I used Pythagoras to solve it

here is the code I used:

    // X placement can be anywhere along the x axis of the object
float xPlacement = Random.Range(0, obstacleWidth);
// Get the distance from the middle of the arc as a positive number and the max height of the arc(obstacle height)
// Use Pythagoras to equate b
float b = Mathf.Sqrt(Mathf.Pow(obstacleHeight, 2) - Mathf.Pow(Mathf.Abs((xPlacement - (obstacleWidth / 2))), 2));
Vector2 intersect = new Vector2(xPlacement, b);

• And if that somehow didn't work, I'm sure the SOHCAHTOA would. – Draco18s Mar 6 '18 at 19:34