Fix Ellipse::intersect() if aa,bb,ee == 0
In general, "aa * x^2 + bb * y^2 + cc * x + dd * y + ee * x * y + ff = 0" can convert "(k1 * x + k2 * y + k3)(k4 * x + k5 * y + k6) = 0". The equation has two lines. The variables aa, bb, .. ff are in the method code. If aa,bb,ee == 0, the equation has one line as the follow.
cc * x + dd * y + ff = 0
But the code is not support for one line. And the function throw the exception or return unexpected value in the condition. Therefore, add treating the number of lines and the process for one line.
The following code is sample test.
#include "2geom/ellipse.h"
#include "2geom/line.h"
void test_ellipse_intersection(Geom::Ellipse &e1, Geom::Ellipse &e2){
try{
auto intersects = e1.intersect(e2);
for(auto &intersect : intersects){
std::cout << intersect.point() << " ";
}
std::cout << std::endl;
}catch(...){
std::cerr << "Abort!" << std::endl;
}
}
int main(int argc, char *argv[]){
Geom::Ellipse e1, e2;
e1.setCoefficients( 4, 0, 1, 0, 0, -4);
e2.setCoefficients( 1, 0, 4, 0, 0, -4);
test_ellipse_intersection(e1, e2); // (1)
e1.setCoefficients( 1, 0, 1, 0, 0, -1);
e2.setCoefficients( 1, 0, 1, 0, -2, 0);
test_ellipse_intersection(e1, e2); // (2)
e1.setCoefficients( 1, 0, 1, 0, 0, -1);
e2.setCoefficients( 1, 0, 1, -2, 0, 0);
test_ellipse_intersection(e1, e2); // (3)
return 0;
}
Output before the patch.
(-0.8944271909999155, -0.894427190999916) (0.8944271909999156, 0.8944271909999161) (0.8944271909999155, -0.894427190999916) (-0.8944271909999156, 0.8944271909999161)
Abort!
Output after the patch.
(-0.8944271909999155, -0.894427190999916) (0.8944271909999156, 0.8944271909999161) (0.8944271909999155, -0.894427190999916) (-0.8944271909999156, 0.8944271909999161)
(-0.8660254037844386, 0.5) (0.8660254037844387, 0.5)
(0.5, -0.8660254037844386) (0.5, 0.8660254037844387)
The following figure is the ellipses in the sample code.

And, I confirmed that running "make test" passed.
And, fix the following URL bug. https://bugs.launchpad.net/inkscape/+bug/1525498