compas.geometry.intersection_ellipse_line_xy

compas.geometry.intersection_ellipse_line_xy(ellipse, line)[source]

Computes the intersection of an ellipse and a line in the XY plane.

Parameters
  • ellipse (tuple) – The lengths a, b of the ellipse’ semiaxes.

  • line (tuple) – XY(Z) coordinates of two points defining another line.

Returns

  • None – If there is no intersection.

  • tuple – Either 1 or 2 intersection points.

Examples

>>> 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])

References

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/