So the idea is that I want to get 20 points in X,Y coordinates between two clicks on a cirlce. The only criteria is that the points always have to be between the smaller angle between the 2 clicks.
Lets say the midpoint of the circle is c.x,c.y, radius is c.r and the two clicks are p1.x,p1.y and p2.x,p2.y
What I tried to do so far is get the angle of both clicks form the X axis with respect to the centre of the circle.
float from = std::fmod(atan2(p1.y - c.y, p1.x - c.x), 2 * M_PI); //Update range to 0-2pi
float to = std::fmod(atan2(p2.y - c.y, p2.x - c.x), 2 * M_PI);
And then get the distance between the two clicks. And calculate the coordinates of the points in a loop.
float fi = from + ((to - from)* i / 20); // 20 points needed
vertices[i] = vec2(c.x + c.r * cosf(fi), c.y + c.r * sinf(fi)); // x = cx+r*cos(fi), y=cy+r*sin(fi)
The problem with this approach is that in some cases it returns the outer curve of the cirlce. Picture shows 3 such curves on 3 clicks. The calculated curves are shown in white, the blue is the desired output. render