-
Notifications
You must be signed in to change notification settings - Fork 943
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
[turf-ellipse] fixes the wrong shape when drawing "big ellipses" near the poles #2739
base: master
Are you sure you want to change the base?
Conversation
-Fixes the wrong behavior of turf-ellipse when drawing "big ellipses" near the poles -Fixes the wrong behavior of turf-ellipse when rotating an ellipse. The rotation is now fully taken account during the calculation of the geometry. -Adds two test to directly check both previous points -Fixes one of the existing test `turf-ellipse` which was not launched when launching `pnpm test` -Changes the test `turf-ellipse` so that it fits the fixes made in the calculation of the geometry
Thanks @hadbn. What a fantastic contribution. Doing some comparisons between the old and new test fixtures, have the "*-degrees" tests been broken all along? This current test output suggests the ellipses have never been the right size longitudinally, let alone the correct shape? Also, and I need to apologise for not mentioning it sooner, there is another ellipse issue open - #1767 It has a solution suggested, and I'm wondering if that could be incorporated into your PR without much extra effort? It would mean (I think) adding an optional Again, sorry for not mentioning this sooner. Didn't expect you to surge ahead with a PR right away! If that's not possible for you let me know and I will have a look myself. |
To be honest, I didn't spend much time studying the old tests so I couldn't say what was functional and what wasn't. However, I did notice a lot of errors like the ones you point out, which motivated me to change how the tests are run. It might also be worth thinking about more "robust" tests. The “in”/“out” comparison tests only allow you to check that the geometry doesn't “change” according to the implementation, but they don't verify the accuracy of the geometry. It was with this in mind that I introduced the two tests of comparison with a circle and invariance by rotation. If you have any other idea of comparison feel free to tell me and I will add them. I actually saw the other issue you are mentionning. As it's my first PR I wasn't sure if I could resolve two issues in a single PR, so I did not. |
In this case closing two issues in the same module will be fine. And happy to stick with the tests the way you're doing them. |
…t they are equidistant from one other
@smallsaucepan here are the modifications. Moreover, this method gives prettier ellipses but I have to admit that it's quite expensive. Are you happy with that ? |
Thanks @hadbn. Discussing with the other maintainers about the performance impact. |
…ence is now optional. The default value for accuracy (0) leads to the same result as previously. Using custom values for accuracy will distribute points along the circumference (which is more precise for "thin" ellipses, but more expensive).
@smallsaucepan as I was concerned about the cost of the new method, I updated the function. The parameter "accuracy" is now optionnal. When not used (or set to 0) the ellipse will be calculated using the historical method. When the parameter is used, the new method will be used. I am -of course- opened to every comment you (or other maintainers) could make. |
-Fixes the wrong behavior of
turf-ellipse
when drawing "big ellipses" near the poles-Fixes the wrong behavior of
turf-ellipse
when rotating an ellipse. The rotation is now fully taken account during the calculation of the geometry.-Adds two test to directly check both previous points
-Fixes one of the existing test
turf-ellipse
which was not launched when launchingpnpm test
-Changes the test
turf-ellipse
so that it fits the fixes made in the calculation of the geometryResolves #2736