-
Notifications
You must be signed in to change notification settings - Fork 17
Add shape level inflate method #169
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
Conversation
Thank you. That looks good overall.
|
Sure, lemme do that. |
Urghhh, making this such a huge change was not my original intention.... Please let me know if you still need me to change the code. |
I would prefer if you don't include the refactoring, it makes the PR harder to read. The more so, the changes broke multiple tests, including several not related to minimum distances:
If you remove the refactoring and the failing tests are still there, I could look at it as well. Could you also remove the |
Additionally, inflating/deflating a polygon may lead to self-intersecting inflated/deflated polygons. There are functions in the library to post-process self-intersecting polygons here https://github.com/fontanf/packingsolver/blob/master/src/irregular/shape_self_intersections_removal.hpp You can see how they are used in the polygon simplification algorithm https://github.com/fontanf/packingsolver/blob/master/src/irregular/shape_simplification.cpp And that would be relevant to have unit tests for these cases. |
So lemme reset the head to 87e77e4? |
Or you can do a commit to undo the changes. It will be squashed in the end anyway. |
No problem I can do reset, that can keep clear commit history. Let's change code step by step. I'll back on code 5 hrs later. |
64c078a
to
87e77e4
Compare
Reset back to 87e77e4, what do you want me to change? |
Thank you. You can do what I mentioned in the first message #169 (comment) and in this other message #169 (comment) Please run the tests locally
And check that the current tests and your new tests are working Please let me know if you get stuck to fix some tests. I could take a look then. |
I think I need to do it step by step to make commit history clear and catch what you want clearly since I'm not a proper C++ developer :(
Please correct me if any mis-understanding. |
Yes, that's it |
I still have FAILED test:
Can you take a look? |
Your new tests only call the code you added:
Please fix these first. |
It seems that the |
Even if the input allows defining circular arcs, the solver doesn't handle them (yet) and there would be multiple other functions to update to do so. But I actually think it's good to have the inflate function generating the rounded corners. For now, we'll break them into multiple line segments after the inflate. So yes, if you feel you can update this function to handle circular arcs, I think it's the best thing to do. I can handle this as well, but probably in at least a few days. |
Got you. I can take a try to implement arc support to the solver, but i think that somehow is beyond the scope of this PR since, I originally just wanna enhance the inflate function. Do you like me to create a seperate PR for implementing arc support to the solver firstly then rebase the pr after that one got merged? Or I continue committing to this PR and you'll just squash them all at the end of the day? |
Implementing full support for circular arc is a big and not that obvious task. If you can have an inflate function using circular arcs which is working and well tested, that would be very good for this PR. Then I could take care of finishing its integration, or you could do it as well if you're more in a hurry |
Lemme make an inflate function using circular arcs first, then think about how to get it well-tested (how to make proper unit test for it). |
Bed time hehe. I'll just commit them here. It will be great if you can take a look into the new inflate function which is still WIP. Another question, what about just implementing the Minkowski sum as the inflate function instead of struggling with such an approximation which I'm writing? |
Choose an approach that you can make work reliably. I refactored and cleaned the shape code. It should be easier to write tests the same way as this one for example now: packingsolver/test/irregular/shape_test.cpp Lines 8 to 17 in 855d304
I also updated the packingsolver/include/packingsolver/irregular/shape.hpp Lines 229 to 244 in 855d304
|
4f92101
to
2825a8a
Compare
Hello @fontanf, The following input was computed in less than 2 seconds. Compilation based on this commit. ![]() And now it gives me a less well optimized result in over 100 seconds : ![]() |
@bbeaulant thank you for your vigilance. I pushed a fix for this on the current dev branch. |
@DusKing1 could you rebase your branch and move the inflate function and its subfunctions to new |
@fontanf yes for sure, lemme commit my latest work and rebase then do the move. I have less fail tests now. I saw your fix on the master branch, thanks for your quick response. |
e58f1d8
to
8317561
Compare
I think now the inflate function is ready for your review. Here are the remaining failed tests that I don't know how to fix:
Please lemme know if you have further change requests. |
Thank you for the update. In the tests, could you check the whole shape instead of the just the min and max? I added a packingsolver/test/irregular/shape_test.cpp Lines 40 to 92 in 6ea89b0
Could you translate Chinese comments into English? To compare to 0, could you use
I'm not a big fan of this, we cannot assume that 0.1 is small. All lengths could be around There are functions to compute angles in the library that you can use directly: packingsolver/src/irregular/shape.cpp Lines 120 to 137 in 6ea89b0
Could the That great to have an Could you undo the changes in |
- move changes into the `include/packingsolver/shape.hpp` file - remove the unused includes from `shape.cpp` - remove from `src/irregular/shape_closure.hpp` the function declarations of functions which are not called outside of `src/irregular/shape_closure.cpp`
cd build/test ctest -R "IrregularShapeInflate.BasicInflate" -V
…r point now the BasicInflate test passed
is_arc_covered_by_adjacent_elements()
Hi, I decided to move the shape package in a separate repository since I need it for other applications. https://github.com/fontanf/shape The shape inflate function should now be added there. I close this pull request. Could you move your code to the new repository? I apologize for the inconvenience. The development of the library is quite active right now and some things change quickly |
Ok, I'll check that repo later, and maybe I'll need some guidance from you on how to setup that repo to continue development. |
The repository is very similar to the previous shape code of the packing library. But do not hesitate if you have question
Great news |
Fix #168 . Please kindly review this and just ask me to change code that you don't want it to be that way. Really appreciate if you can find your time to do the review job!