Skip to content
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

Satin error combines shapes in BSG #69

Open
tatyanade opened this issue Jun 28, 2020 · 2 comments
Open

Satin error combines shapes in BSG #69

tatyanade opened this issue Jun 28, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@tatyanade
Copy link
Contributor

2020-06-27_20h29_29
2020-06-27_20h29_17

Running BSG with satin stitch, and it adds a line connecting some of the shapes(you can see in the picture above) while parallel stitch leaves them seperate

Running basically the code from BooleanOps animated does this

import processing.embroider.*;

PEmbroiderGraphics E;

void setup(){
  size(600,600);
  smooth();
  E = new PEmbroiderGraphics(this);
  E.setPath(sketchPath("bsg_test.vp3"));
  //E.noStroke();
  E.fill(0);
  //E.hatchMode(E.PARALLEL);
  E.hatchMode(E.SATIN);
  noLoop();
  
  PEmbroiderBooleanShapeGraphics BSG = new PEmbroiderBooleanShapeGraphics(width,height);
  
  BSG.rect(300,200,100,100);
  BSG.operator(PEmbroiderBooleanShapeGraphics.AND);
  BSG.circle(400,200,100);
  
  BSG.operator(PEmbroiderBooleanShapeGraphics.OR);
  
  BSG.circle(100,100,100);
  BSG.operator(PEmbroiderBooleanShapeGraphics.XOR);
  BSG.circle(150,100,100);

  BSG.operator(PEmbroiderBooleanShapeGraphics.OR);
  
  BSG.circle(100,250,100);
  BSG.circle(150,250,100);
  
  BSG.rect(300,50,100,100);
  BSG.operator(PEmbroiderBooleanShapeGraphics.DIFFERENCE);
  BSG.circle(400,50,100);
  
  E.image(BSG,0,0);


  E.optimize();
  E.visualize();
  E.endDraw();
  save("PEmbroider_satin_booleanOps_visAnim.png");
}
@golanlevin golanlevin added the bug Something isn't working label Jun 28, 2020
@golanlevin
Copy link
Member

Definitely a bug. @LingDong- , could you kindly check this out.

@LingDong-
Copy link
Collaborator

So the algorithm can sometimes process multiple shapes in one pass (making a jump in-between), so the jump ends up being part of the design.
One solution would be to create multiple masks for each shape, and run the algorithm on each mask. However this will be quite inefficient.
To create the multiple masks we either need to use flood fill yet again (pretty slow), or first trace contours and re-render (probably taster, but more complicated and more prone to degenerate cases).
Wonder if there's a better solution.

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

No branches or pull requests

3 participants