- compas.geometry.intersection_ellipse_line_xy(ellipse, line)
Computes the intersection of an ellipse and a line in the XY plane.
ellipse (tuple[float, float]) – The major and minor of the ellipse.
line ([point, point] |
compas.geometry.Line) – A line defined by two points, with at least XY coordinates.
tuple[[float, float, float], [float, float, float]] | [float, float, float] | None – Two points, if the line goes through the ellipse. One point, if the line is tangent to the ellipse. None, otherwise.
Based on 1.
C# Helper. Calculate where a line segment and an ellipse intersect in C#. Available at: http://csharphelper.com/blog/2017/08/calculate-where-a-line-segment-and-an-ellipse-intersect-in-c/
>>> ellipse = 6., 2.5 >>> p1 = (4.1, 2.8, 0.) >>> p2 = (3.4, -3.1, 0.) >>> i1, i2 = intersection_ellipse_line_xy(ellipse, [p1, p2])