I guess you already found that out but I thought I tell it anyway.
So I nailed the weird arc behaviour down to tmp2 (actually is2).
The order of the start angle and the end angle of the weird looking arc is transposed. That's because the start point and the end point are transposed in is2 as well!!!
Normally (on correct arcs), the first angle in tmp2 is the angle of the start point and is followed by the angle of the end point.
For the weird looking arcs it's the opposite (end point/angle comes first and then the start point/angle).
That's why I think the problem has to be somewhere in the sorting code.
Somewhere in rs_hatch.cpp at about line 335
// sort the intersection points into is2:
RS_Vector sp = startPoint;
...
The problem is, if I just step through the code, it looks like librecad bahaves correctly.
Another thing I found out is, when I add
qDebug("angle centerToNextIntersection: %f",a);
after these lines of code in the sorting process:
case RS2::EntityArc:
case RS2::EntityCircle:
a = center.angleTo(*v);
dist = reversed?
fmod(sa - a + 2.*M_PI,2.*M_PI):
fmod(a - sa + 2.*M_PI,2.*M_PI);
->here->
the weird behaviour seems to be gone!
->
Maybe there is something wrong with *v in a = ellipse->getEllipseAngle(*v); ???
or here:
is2.append(std::shared_ptr<RS_Vector>(new RS_Vector(*av))); ????