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

simple E.rect problem #93

Closed
stephanschulz opened this issue Aug 21, 2020 · 2 comments
Closed

simple E.rect problem #93

stephanschulz opened this issue Aug 21, 2020 · 2 comments

Comments

@stephanschulz
Copy link

This code should draw 2 noFill rectangles with a strokeWeight > 1
But only one gets drawn.

Screen Shot 2020-08-21 at 2 30 40 PM

import processing.embroider.*;
PEmbroiderGraphics E;


void setup() {
  noLoop(); 
  size (1400, 1400);

  //700 is half hoop size
  String name = "grid";
  E = new PEmbroiderGraphics(this, width, height);
  String outputFilePath = sketchPath(name+".jef");
  E.setPath(outputFilePath); 
  E.strokeWeight(1);

  E.beginDraw(); 
  E.clear();
  E.noFill(); 


  E.pushMatrix();
  E.translate(210, 100);
  E.strokeWeight(10);
  E.rect(0, 0, 90, 90);
  E.popMatrix();

  E.strokeWeight(3);
  E.rect(110, 100, 90, 90);
  
  //E.strokeWeight(1);
  //E.rect(10, 100, 90, 90);
  //-----------------------
  E.optimize(); // slow, but very good and important
  E.visualize(true, false, false);
  E.endDraw(); // write out the file
  save(name+".png");
}

If I uncomment the 3rd E.rect then all 3 get drawn properly.

Screen Shot 2020-08-21 at 2 32 38 PM

@LingDong-
Copy link
Collaborator

Thanks for the report, now fixed: 0da6549
It's actually a problem derived from E.optimize(). i.e., one of the rects is "optimized out" by mistake, which is itself derived from the border making code, which generated a bunch of empty segments which confused the optimizer.

@golanlevin
Copy link
Member

😍 Thanks for addressing this @LingDong- !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants