Skip to content
This repository has been archived by the owner on May 15, 2020. It is now read-only.

Hollow Polygon #5

Open
donatellosantoro opened this issue Jul 16, 2018 · 2 comments
Open

Hollow Polygon #5

donatellosantoro opened this issue Jul 16, 2018 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@donatellosantoro
Copy link

Hi there,
we found an issue regarding the placing of hollow polygons with USE_HOLE = false. In particular we expect that using this parameter we'll never have a polygon inside another.

However, running the following code, we have the same result both with USE_HOLE = false and USE_HOLE = true.

    NestPath binPolygon = new NestPath();
    double width = 400;
    double height = 400;
    binPolygon.add(0, 0);
    binPolygon.add(0, height);
    binPolygon.add(width, height);
    binPolygon.add(width, 0);

    List<NestPath> list = new ArrayList<NestPath>();
    NestPath outer = new NestPath();
    outer.add(600, 0);
    outer.add(600, 200);
    outer.add(800, 200);
    outer.add(800, 0);
    outer.setRotation(0);
    outer.bid = 1;
    list.add(outer);
    NestPath inner = new NestPath();
    inner.add(650, 50);
    inner.add(650, 150);
    inner.add(750, 150);
    inner.add(750, 50);
    inner.bid = 2;
    list.add(inner);

    Config config = new Config();
    config.SPACING = 0;
    config.USE_HOLE = false;
    Nest nest = new Nest(binPolygon, list, config, 2);
    List<List<Placement>> appliedPlacement = nest.startNest();

The result is the follow: as you can see, the second polygon is placed inside the first one.
schermata 2018-07-16 alle 12 17 56

Can you confirm that this is not the expected behavior?
Thanks

@Yisaer
Copy link
Owner

Yisaer commented Jul 16, 2018

We use several NestPath to describe a Ploygon with Holes. If you want to have a Hollow polygon with one hole, you have to create 2 NestPath . So in your Example, NestPath outer and NestPath inner described ONE hollow polygon with rect hole, so it is correct for the result. The Svg result have some bugs dealing with expressing Hollow Polygon currently in my project.

@Yisaer Yisaer self-assigned this Jul 16, 2018
@Yisaer Yisaer added the bug Something isn't working label Jul 16, 2018
@oreasono
Copy link
Collaborator

@donatellosantoro It would be much appreciated if you help us build some JUnit test classes in this scenario~

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants