0
\$\begingroup\$

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.

intersection of arc

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.

\$\endgroup\$
  • \$\begingroup\$ 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)? \$\endgroup\$ – Leo Mar 6 '18 at 16:04
  • \$\begingroup\$ Yes, someone informed me I can use Pythagoras, seems simple now! \$\endgroup\$ – Col.Cook Mar 6 '18 at 16:21
  • \$\begingroup\$ I have been trying to write an answer but I'm terrible at explaining trigonometry using English :) \$\endgroup\$ – Leo Mar 6 '18 at 16:25
  • \$\begingroup\$ Me too, I think just saying Pythagoras is enough to lead to the right direction, I put my code below \$\endgroup\$ – Col.Cook Mar 6 '18 at 16:26
2
\$\begingroup\$

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);
\$\endgroup\$
  • \$\begingroup\$ And if that somehow didn't work, I'm sure the SOHCAHTOA would. \$\endgroup\$ – Draco18s Mar 6 '18 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.