Closed Zinoex closed 1 year ago
Thanks for taking the time to create a MWE.
There are two rays: r1
, r2
. r1
is part of the final representation and r2
is cut-off by halfspace 3.
It is trying to add a ray that belongs to halfspace 3 by combining r1
and r2
.
The issue is that r1
belongs to the halfspace 3 (which you can see since value1
is 4e-13
.
So this
https://github.com/JuliaPolyhedra/Polyhedra.jl/blob/1cc19df35ea62efc3fefa162f709f04d09ea4c94/src/doubledescription.jl#L397
should have stopped add_intersection!
because there is no ray to add here!
Why did isin
return false
while r1
belongs to the hyperplane of the 3rd halfspace ?
This is because when we checked it here: https://github.com/JuliaPolyhedra/Polyhedra.jl/blob/1cc19df35ea62efc3fefa162f709f04d09ea4c94/src/doubledescription.jl#L321, it returned -1.531648132849239e-7
which is not considered to be zero.
But then, the scalar product because 4.0034642267983145e-13
after the ray r1
was line_project
ed with the line cut-off by the hyperplane of the 1st halfspace.
This line_project
should not alter whether the ray belongs to the 3rd hyperplane since the line should belong to it but the scalar product with the line is 1.486455444843493e-8
so...
Changing the tolerance might help here but what we should really do is something more numerically stable like SVD-based for these cutoff lines
Thank you for taking the time to review this and update the show
message. Since I was only interested in the normal vectors of the half-space constraints, I was able to center and rescale the V-representation to avoid the numerical issues that you have concluded. Changing the tolerances may have worked too. Again thank you for taking the time.
I have been hitting an
AssertionError
when finding the H-rep from a V-rep. Specifically, when taking a linear combination of two rays on Line 361 of doubledescription.jl. I have narrowed it down to the following MVE. The concrete values forvalue1
andvalue2
arevalue1 = 4.0034642267983145e-13
,value2 = 0.9999999999843894
.I've been trying to understand what is going on in the method to see if I could fix it myself including comparing the method to cddllib, and to my understanding, cddlib does
abs(value2) * r1 + abs(value1) * r2
, which different from what the comment in this method says. Is one method favorable to another and how can I fix the issue above?