Open lordofhyphens opened 5 years ago
Just FYI, there is a C version of SVGNest from the same author : Deepnest I don't know if it could be of any help
Thanks @gege2b I'll try run it and test it. It would be really helpful to have a C implementation rather than JS :) It's mainly JS but the critical parts were rewritten in C.
Today I'm investigating the auto-arrange code in slic3r.
There may be two different entry point for auto-arrange:
Be sure to use the same check algo for both, or to be sure that the check can't trigger after an arrange.
EDIT: Okay that was fast :D I think I got it. Cross product of the two vectors formed by the first 3 points (we only need the first 2 vectors) if its result is positive then the polygon is anti-clockwise. Let me know if I'm missing something or if anyone likes to add anything :)
I'm having some trouble finding if the polygon is clockwise or anti-clockwise.
If anyone can help point me to something I can read on that I'd be grateful.
What I understand so far is that clockwise means that it's stored in a way that it's points are going in clockwise direction, but I'm not sure how to calculate that. I'm guessing it has something to do with cross product of every two consecutive vectors or something like that.
You can check Polygon.hpp in xs/src/libslic3r as it has is_clockwise function https://github.com/slic3r/Slic3r/blob/master/xs/src/libslic3r/Polygon.hpp#L36
Thanks @Samir55 :)
Did anything come of this? Asking for the FreeCAD folks who are interested in a similar function for the Path/CAM workbench.
You may want to look into the arrangement in PrusaSlicer, inspired by svgnest. Cura recently adopted our PrusaSlicer code.
@bubnikv cool, care to share a link ?
Als interested in a nesting feature for freecad, so came across this issue. @luzpaz This might be of interest to you: https://github.com/grotius-cnc/Nest4J Still java, no c++ but more interfacing features.
@luzpaz I think this is the link you were looking for to the nest2D library. https://github.com/tamasmeszaros/libnest2d
Theres also this porting attempt to c++ https://github.com/kallaballa/nestcpp
Basically you would want to have this but then for Freecad: https://github.com/NicoSchlueter/FuseNest
Development log for GSoC 2019 project to implement #3237.