# Why is the intersection of a polyhedra with itself not equal to itself?

using Polyhedra
import CDDLib
lib = CDDLib.Library()

P = polyhedron(vrep(Acolums,Is),lib) #(lines=Acolums , rays = Is)

println(intersect(P,P) == P ) # it should be true but it gives false

How can it be made to return true

what is `Acolums`? is it possible to post runnable code?

The answer seems to be that `intersect` gives you

``````Polyhedron CDDLib.Polyhedron{Float64}:
10-element iterator of HalfSpace{Float64, Vector{Float64}}:
``````

which is not `VRep`.

@jling

P=polyhedron(vrep([Line([1, 0, -1, 0, 1]), Line([0, 1, 0, -1, 1])],[Ray([0, 0, 1, 0, 0]), Ray([0, 0, 0, 1, 0]), Ray([0, 0, 0, 0, 1])]),lib )

println(intersect(P,P) == P)

is this no vrep ?

the result of `interset` is not Vrep

@jling how to overcome this situation?

no idea, `convexhull(P, P)` gets you closer, but you need to remove redundant, and then the order of the vertices still different.

I think this package is not meant to be used like this, it’s like you can’t use floating point calculation to make sure to expressions evaluate to the same result. This package is numerical.

@jling Is there a suitable package-library where I can create polyhedra with rays and lines and find their intersects?

Oscar.jl has intersection functionality for polyhedra:
https://oscar-system.github.io/Oscar.jl/stable/PolyhedralGeometry/Polyhedra/constructions/#intersect-Tuple{Polyhedron,%20Polyhedron}

Happy to help (or find someone to help) if you have problems using it.