FS#2565 - NaN length for arbitrary ellipse arc
Andrew,
Probably not OS or QCAD version related.
The ellipse arc in the example file is drawn CCW and then the start parameter was set to 180. (All part of a test of newer code for the nearest point on an ellipse)
Its end parameter was originally 44.56263613...
If we reload this file its properties are:
- Not reversed (CCW)
- ratio is 0.42307692...
- Parameters are 180 & 404.56263613...
- The reported length is about 1993.21829743...
To replicate the issue you must draw over this ellipse shape:
- EA ; Direction CCW
- SR for snapping to references.
- Indicate the major, minor, start and end point all by snapping to the original references.
You now have a copy of the provided ellipse shape.
Select it with Alt-Select, it is the one without a length.
Properties are:
- Not reversed (CCW)
- ratio is 0.42307692...
- Parameters are 180 & 44.56263613...
- The reported length is NaN
I can replicate that for some other CCW ellipse arcs ...
... Perhaps given that the start parameter is 180 degrees.
Also suspecting that it can be replicated for CW arcs.
For the record:
A 2D wire Centroid for this shape also fails.
Simply because it tests for the length reported by QCAD.
It doesn’t start to approximate something that is about zero long.
Regards,
CVH
In the code of REllipse::getLength() using getSimpsonLength:
→ For not reversed and not a1<a2 there is no route if a1===Pi resulting in NaN.
The a1<a2 branch has a non-strict inequality allowing for Pi.
Some non-strict inequalities should be implemented for the second branch.
Or simply add 2Pi to the end parameter on creation.
As is when reloading the reloaded file.
Regards,
CVH