using Polyhedra import GLPK lib = DefaultLibrary{Float64}(GLPK.Optimizer) P1 = polyhedron(vrep([ -1.9 -1.7 -1.8 0.5 1.7 0.7 1.9 -0.3 0.9 -1.1 ]), lib) P2 = polyhedron(vrep([ -2.5 -1.1 -0.8 0.8 0.1 0.9 1.8 -1.2 1.3 0.1 ]), lib) Pch = convexhull(P1, P2) hrepiscomputed(P1), hrepiscomputed(P2), hrepiscomputed(Pch) npoints(Pch) removevredundancy!(Pch) npoints(Pch) using Plots plot(P1, color="blue", alpha=0.2) plot!(P2, color="red", alpha=0.2) plot!(Pch, color="green", alpha=0.1) scatter!(Pch, color="green") Pint = intersect(P1, P2) hrepiscomputed(P1), vrepiscomputed(P1), hrepiscomputed(P2), vrepiscomputed(P2) hrepiscomputed(Pint), vrepiscomputed(Pint) npoints(Pint) hrepiscomputed(Pint), vrepiscomputed(Pint) using Plots plot(P1, color="blue", alpha=0.2) plot!(P2, color="red", alpha=0.2) plot!(Pint, color="yellow", alpha=0.6)