NestingCShaprt icon indicating copy to clipboard operation
NestingCShaprt copied to clipboard

NFP generation

Open theveloped opened this issue 6 years ago • 7 comments

@dharani811 that looks amazing! Thank you for sharing it. I have one question again relating to the NFP generation using Clipper. Do you only use the polygon with the largest area produced by the Minkowski Sum for the NFP (referenced code). Would that not yield inaccurate result in some cases if the input has holes or is concave?

Also, it seems you are using both the sliding method for generating the NFP as well as Minkowski. Is there a reason for this and when do you use which?

theveloped avatar Nov 16 '18 10:11 theveloped

@theveloped :

i think you're referreing to this:

        bool searchEdges = config.isCONCAVE();

    if (searchEdges)
            {

                // NFP Generator TODO  double scale contorl
                nfp = GeometryUtil.noFitPolygon(A, B, false, searchEdges);
                if (nfp == null)
                {

                }
            }
            else
            {

                nfp = GeometryUtil.minkowskiDifference(A, B);
            }

The goal is to use Minkowski if both of them is Convex and Sliding method if one or both are Concave. But i am currently assuming all the parts are convex and using Minkowski by default https://github.com/Jack000/Deepnest/issues/34#issuecomment-434295007. Currently the parts with holes does produce faults, but for the first revision i am only working with rectangular sheets with only convex parts.If done with that then i will concentrate on NFP with holes (Assuming only Concave parts produce NFP's with holes) and other parameters as mentioned in the referenced link.

Let me know if you need further clarification.

dharani811 avatar Nov 17 '18 04:11 dharani811

Thank you for your quick reply. Indeed this explains a lot. In the Minkowski difference implementation is however seems you are also using only the largest polygon:

for (int i = 0; i < solution.Count; i++)
            {

                NestPath n = PlacementWorker.toNestCoordinates(solution[i]);
                double sarea = GeometryUtil.polygonArea(n);
                if (largestArea > sarea)
                {
                    clipperNfp = n;
                    largestArea = sarea;
                }
}

Is there a spicific reason you are not using the additional polygons?

theveloped avatar Nov 20 '18 15:11 theveloped

@theveloped : this is to eliminate holes inside the NFP , assuming the fact that outer polygon is the one with largest area.

dharani811 avatar Nov 21 '18 05:11 dharani811

The assumption that the largest area is the outer contour should always be valid I think. I think however that sometimes an NFP can have valid holes. And if so, a position on one of these holes in the NFP is often a very good choice for nesting.

theveloped avatar Nov 21 '18 18:11 theveloped

Yes, sometimes holes have good position to place.however sometimes it is giving me faulty results, that is something which I need to look into,that's why for now I have removed the inner NFP'S.I will look into it soon.

dharani811 avatar Nov 22 '18 01:11 dharani811

Ah, that makes sense. Thanks for all the clear explanations! I'm currently having trouble with the faulty holes generated by clipper too. So, if you find a nice solution I'd be happy to hear it :)

theveloped avatar Nov 22 '18 07:11 theveloped

Dear Sir ,

We require your Help in Nesting Software . Pls kindly send us your Contact Info .

JhonJebaraj avatar Mar 02 '19 12:03 JhonJebaraj