Ellipse inscribed in irregular convex quadrilateral
Drag around points P00 P20, P22, and P02.
Improved version of Juan Carlos Ponce Campuzano's Ellipse
That didn't work for horizontal trapezoid, parallelogram, rectangle, etc
Setup
P00 = (0, 0)
P20 = (2, 0)
P22 = (2, 2)
P02 = (0, 2)
square = Polygon({P00, P20, P22, P02})
P11 = Intersect(Line(P00, P22), Line(P02, P20))
x0 = Line(P00, P02)
x2 = Line(P20, P22)
x1 = Line(P11, Intersect(x0, x2))
y0 = Line(P00, P20)
y2 = Line(P02, P22)
y1 = Line(P11,Intersect(y0, y2))
P10 = Intersect(x1, y0)
P21 = Intersect(x2, y1)
P12 = Intersect(x1, y2)
P01 = Intersect(x0, y1)
xy1 = Line(P01, P10)
xy3 = Line(P12, P21)
xy4 = Line(P22,Intersect(xy3, xy1))
P13 = Intersect(x1, xy4)
c = Line(P01, P22)
c' = Line(P13, P21)
C = Intersect(c, c')
Ellipse = Conic(P10, P21, C, P12, P01)