I have done a lot of research on the topic, but I don't seem to have the right questions to ask. I don't know what to call the problem I'm trying to solve. Thank you in advance for any help.
The problem
Suppose I have a user-drawn circle like this:
The circle isn't quite closed, because of user error (it will be drawn with a finger). I want to close the circle, like this:
I only want to do this if the ends of the user-drawn path are close enough together, like so:
This example is exaggerated. I would want them to be closer together than that.
Potential Problems
- The circle (or ellipse) can be at any orientation.
- There is no way to force the user to draw a circle, so the user can draw anything, as long as it takes a single stroke.
Thus, I only wish to take the last few points into account and sort of linearly-interpolate between the endpoints.
Conclusion
If you could direct me to a solution/implementation I would be very grateful. Also, if you could tell me what this problem is actually called, or the terminology involved, I could search online for more help. Thanks again!