I'm currently working on my computer science culminating and I'm stuck and cannot seem to find any answers on similar questions asked on stack overflow.
The problem I am trying to solve is there are three given points in the form (x, y) on a screen (1280 by 720 where the top left corner is (0, 0)) and you have to find a curve that passes through all three points.
So, knowing there are three points, you know that they form a triangle. After finding the circumcentre, you now have:
- The radius,
- The origin,
- And three angles
The curve must start at the first given point, pass through the second given point, and end at the third given point.
int pointX = Math.round(circumcentreX + radius * Math.cos(angle));
int pointY = Math.round(circumcentreY + radius * Math.sin(angle));
Above are the equations I found to find the points on the curve given the angle.
I also know how to find the angles of the three given points with Math.atan2(y, x);
The main problem I have is finding the angles that lie on the curve. So far I have
float angle = (float)Math.toRadians(beginningAngle - (beginningAngle - endAngle) * t);
, where t is the percent of the curve it is at, but it doesn't work half the time.
The angles of the circle would be where North is 270, East is 0, South is 90, West is 180.
Here is what the curve should look like
Angles: 183.57921 : 264.60202 : 358.09354
X coordinates: [473, 597, 747]
Y coordinates: [376, 248, 380]
Here is a case of where it fails
Angles: 179.00537 : 270.5897 : 2.6373901
X coordinates: [473, 614, 752]
Y coordinates: [376, 234, 380]
Please let me know if you found a way to find the angles or would like some source code. Thank you in advance!