danhey / ellipse

Fast analytic solutions for the intersection of two ellipses in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

⚠️ IN DEV. DO NOT USE. Fast analytic solver for the intersection of two ellipses of arbitrary rotation in Python

TODO:

  • Currently this only works if the ellipses are intersecting at four points. I need to write checks.
  • If the ellipses have the same rotation then the output is not proper.

Usage

Basic syntax of creating an ellipse:

Ellipse(rx, ry, rotation, origin)

To calculate the intersection of two ellipses

from ellipse import Ellipse, intersection
el1 = Ellipse(5, 20, 1)
el2 = Ellipse(5, 10, 0)
x, y = intersection(el1, el2)

To plot the intersection

fig, ax = plt.subplots()

el1.plot(ax)
el2.plot(ax)

ax.scatter(x, y)

example

About

Fast analytic solutions for the intersection of two ellipses in Python


Languages

Language:Jupyter Notebook 86.7%Language:Python 13.3%