-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor QgsCircularString::curveToLine #4746
Conversation
This became both a bugfix and an enhancement. Do you see any reason to use the old behavior of output being non-symmetric ? As that would need a parameter... |
Another enhancement that could be added is avoiding duplicated vertices in a multi-arc curve, whereas right now there will be an additional duplicated point on every arc. |
Oh, one more note: the code before this change had a control structure ensuring that the control point in the input curve still appeared in the output curve. I obviously removed that check because it's clearly incompatible with a symmetric output. If there's any good reason to retain that point it should once again become a parameter to keep it. I cannot think of any good reason, but there's a test guarding for that, which is currently failing: https://travis-ci.org/qgis/QGIS/jobs/263558531#L1785 |
@mhugent or @andreasneumann do you know why it was desired for control point to always be in output ? For a regularly-spaced output the control point may be just very close to previous or next vertex, introducing vicinities that are probably not wanted.. |
@edigonzales can you help here? Or maybe @mhugent ? |
Commit da18565 restores control point addition (while avoiding a point duplication). Chances of nearby points are still there. |
Travis succeeds with Python 3.5 and fails with Python 3.3 but I don't see what's the error in here: https://travis-ci.org/qgis/QGIS/jobs/267145607 |
nothing Python related |
the build with Python 3.5 is for code layout (spelling, syntax, sip bindings, etc) |
@3nids can you tell what's missing in this case, for the build to fail ? |
got it, now that I followed the CDash link (sorry) - it would be great to see that link in cubital fonts in the logs of the build :) |
This PR should now be passing Travis, but I had to expect the control point to be in the output for all new tests I added. I don't really like to see that control point in, because it makes the output ugly in the best case (non same-length segments) and dangerous at worst (very small segments). @edigonzales, @mhugent, @andreasneumann I'm still interested in your opinion about this: why is it desired to have control point in output ? |
I'm working on adding a parameter to make it optional to force or not inclusion of the control point, but I still think the default should be NOT to force it, do you agree ? |
now the test fails for an unrelated issue ... |
Rebased to latest-passing commit, to see if that fixes this unrelated error:
|
Ok I surrender: the failure is not unlrelated. It's for "interpolateAngle" which ensures to always work on linearized curve. Then computes the angle parallel to the "curve" at the specified distance. It is expected that the number can be slightly different upon refactoring the curveToLine function. The other are similar: functions that operate on segmentation of curves. I'll update the expected results. Then one day these functions will work directly on curves so that the results will be more precise |
Expected results updated, but I'd love to be able to have the control point not added by default before doing this, as that additional point may very well affect reuslts. So say, the same curve (only defined with a different control-point) would end up having a different centroid, or interpolated angle, or located point. It isn't nice is it ? Control point is any point on the arc, so could be everywhere, hardly with a meaning on itself other than defining the curve... |
I'm +0 on this, but am not a heavy curved geometry user myself so don't know exactly what users want in this situation. In the absence of any reply from @mhugent or @andreasneumann I'd say your safe to go with your instinct and change the behavior. |
Fixes qgis#16717 Fixes qgis#16722 Include tests
…ference curves These values change because they are computed on the *linearization* of those curves, and refactoring linearization codes results in slighly different values. NOTE: adding or not adding the control point would also affect these results
This reverts commit dae9d02.
Ok rebased to fix conflicts and reverted to NOT include the control point, let's see how centroid/interpolateAngle/locatPoint change again with this (maybe those tests should be made more tolerant, btw) |
There are more tests in dedicated file (testqgscurve.cpp)
I'm considering this closed, no force of central point. Curves will be segmentized with segments of equal length. |
bool addP2 = true; | ||
if ( qgsDoubleNear( circlePoint1.x(), circlePoint3.x() ) && qgsDoubleNear( circlePoint1.y(), circlePoint3.y() ) ) | ||
{ | ||
addP2 = false; | ||
} | ||
|
||
for ( double angle = a1 + increment; angle < a3; angle += increment ) | ||
addP2 = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@strk this has left a lot of unreachable code in the loop below - was this intended?
On Thu, Aug 31, 2017 at 10:04:21PM +0000, Nyall Dawson wrote:
- for ( double angle = a1 + increment; angle < a3; angle += increment )
+ addP2 = false;
@strk this has left a lot of unreachable code in the loop below - was this intended?
I was intended in case anyone (@andreasneumann?) comes out with
a reason why that control-point addition was required to be in output
in the first place (there was a testcase guarding for that occurrence)
To me, the code needs to go, but I feel like stepping on somebody's
thought by removing that part (although nobody complained so far)
|
Fair enough. In that case can we |
@strk: control point on segmented curve was a requirement in the first implementation. I've asked back at the office that ordered this functionality. It seems it's ok for them if it is removed. |
Drops the unused support for including control points in output. See qgis#4746 (comment)
Thanks @mhugent - @nyalldawson please see #5120 5120 |
See https://issues.qgis.org/issues/16717
and https://issues.qgis.org/issues/16722