[Feature request] defining a Circle() from 3 points
typhoon71 opened this issue · 12 comments
I was wondering if it could be possible to implement defining Circle() from 3 points.
I found this "https://stackoverflow.com/questions/52990094" and was wondering if it could became a builtin.
I also found this: "Sympy https://docs.sympy.org/latest/modules/geometry/ellipses.html#sympy.geometry.ellipse.Circle."
I feel like it would be good to have it built in scikit-spatial, would it be possible?
edit:
I'll leave this one here, but I'm now using 2 points and the sagitta to determine the circle (works better in my application).
I can't really start asking new methods every time I'd like them, and .intersect_circle already was a game changer.
Would it be the right direction for scikit-spatial to have more general 2D methods?
It shouldn't overlap too much with other projects ... I think.
Yeah I think that would be a good fit in this library. I'll work on it sometime soon.
ehm, thank you. didn't refresh... please read the edit, and thanks a lot!
Hi @typhoon71!
After you edited your own question, it's not clear to me if you still want a classmethod to compute a circle from three points or something else. Can you provide further details, please? Thanks!
My case:
I'm given the 2 end-points of a segment, and the value of the sagitta (which basically gives me a third point).
I need to get the circle passing by those 3 points.
- in my original request I was thinking of calculating that third point myself, and just ask for a classmethod to compute a circle from three points
- then I started to think to use the sagitta value
So I'm actually asking 2 class method.
I have segments lenghts around 50 to 200, and sagitta values from .5 to 5.
(I'm currently experiencing some issues with what I found online and I'm trying to understand if the cause is related to rounding or is just a mistake of mine; I may ask for help about this later, in another post)
Update: I have a working rough draft of the code to compute a circle from three points.
I'll add the class method Circle.from_points
which takes three points as inputs and returns a Circle
object.
Thank you, awesome news.
I really want to test this new method because when I try to do it with what I got... the circle I get does not pass from the 3 starting points - there's a really small distance, but it's there.
Update: I have a working rough draft of the code to compute a circle from three points.
I'll add the class method
Circle.from_points
which takes three points as inputs and returns aCircle
object.
Hi @ajhynes7, great! Thanks!
@typhoon71 Two points and the sagitta value are the inputs required to define a circular arc. So, maybe, we could define a from_arc
classmethod that requires two points and a float.
@ajhynes7 Do you think this classmethod could be a valuable addition to the library?
Will from_arc
still be needed after adding from_points
?
from_arc
would be easier to use when you don't have the 3 points, but 2 points the arc sagitta (my case).
I guess it would be a particular case.
Are you able to solve your problem with Circle.from_points
? It's available now in the new release.
I just tested Circle.from_points
(thank you), and while it works fine it doesn't solve my issue.
I'm pretty sure (after some investigation) that what I'm experiencing is floating point rounding/precision - and that doesn't go well with the stuff I'm doing (geometry).
If you are interested I can open a post about it - hopefully some better mind can give me a good push in the right direction.
Yeah I think opening a new issue would be appropriate here.