Maybe I have just a late night brain fog, but it seems I get an error if I try to make full 0-360 circle. I can do 0-359 or 0-361 but not a simple full circle.
What am I missing? ![]()
Maybe I have just a late night brain fog, but it seems I get an error if I try to make full 0-360 circle. I can do 0-359 or 0-361 but not a simple full circle.
What am I missing? ![]()
Nothing. I missed something when I implemented the nomalizing angles to be between 0-360. For example if you hover over the āerrorā label you will see the error:

What I missed is that 360 gets normalized to 0: That is 360 - 360 = 0⦠just like 361 -360 = 1 where 361 and 1 are the same angle. Except an angle of 360 is a special case and should not be normalized.
So what is happening is angles of 0 and 360 normalize to 0 and 0⦠and Error. ![]()
Iāll work on a fix for next release. In the mean time if you used 359.9999 it would be close to 360 to not make a difference.
If you could make it so any Angles equal would render a full circle instead of an error, that would be ideal. It seems to me like it shouldnāt be any more daunting than making a single exception, but I donāt know the code.
![]()
I think the Angles equal check in the arc Arc dialog is there for a reason⦠I suspect that a 0 to 0 circle will yield a point? Also there are probably other tools that have a similar issue - like the Elliptical Arc. So instead of fixing all the tool dialogs this may affect, it will be easier to just fix the upstream normalize routine. Just need to check 1st in the routine if the angle is equally divisible by 360 :
double remainder = std::fmod(number, 360.0); if (std::abs(remainder) < 1e-9) { return 360.0; } else { normalize n as usual; return n; }
It took a bit but I figured how to fix the issue. It was a bit more than just checking if the angle was 360 or not⦠also had to check if it was NOT 0. ![]()
Plus there were several places of the code for displaying the graphics where I had to also normalize the angles that had me baffled for awhile. ![]()
Anyhow, once I apply the fix to the Elliptical Arc and cleanup some code I commented out⦠Iāll make a PR that should make the next scheuled release. ![]()
For those interested here is the final generic normalize function:
qreal normalize(const qreal value, const qreal start, const qreal end) { // check if value is not start value & is evenly divisble by end value if (qFabs(value) != start && std::fmod(qFabs(value), end) < 1e-9) { return end; } const qreal range = end - start ; // const qreal offsetValue = value - start ; // value relative to 0 // add start to reset back to start of original range return (offsetValue - (floor(offsetValue / range) * range)) + start ; }
and a call to the function:
result = normalize(result, 0.0, 360.0);
thank you @Douglas for the work on so many multiple fronts!
Bravo! Thank you @Douglas !
@Douglas ā Does this PR completely fix this issue?
Yes. As well as cleaning up a bunch of code.