I am using SymPy's geometry module to intersect line segments and circles. It seems only some intersection points are being counted, while many others are ignored.
Here is some test code for finding the intersection points:
from sympy.geometry import Point2D, Segment2D, Circle
# Point A, B and C
A = Point2D(1, 1)
B = Point2D(3, -1)
C = Point2D(-2, -2)
# Segment from A to B
f_0 = Segment2D(A, B)
# Segment from A to C
f_1 = Segment2D(A, C)
# Circle with center A and radius 0.8
c = Circle(A, .8)
i_0 = c.intersection(f_0)
i_1 = c.intersection(f_1)
print(i_0)
print(i_1)
This should work, and does catch all intersection-points when doing line-circle intersection or circle-circle intersection, but not segment-circle nor ray-circle intersection. Here is the output:
[]
[Point2D(217157287525381/500000000000000, 217157287525381/500000000000000)]
It's obviously not working as intended. I don't know what causes this, and I'd like to know how to fix it or find any alternatives (preferably still using SymPy).