Skip to content

Unifying beziers curves when finding chains returns some arcs in pathContext instead of the bezier seed paths #622

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

Open
ggoodkey opened this issue May 12, 2025 · 2 comments
Labels

Comments

@ggoodkey
Copy link
Contributor

I am expecting that calling model.findChains with the unifyBeziers option set to true, should return the bezier seeds instead of the individual arcs. However, some links (every other?) in the chain contain the last arc of the curve as the returned pathContext instead. This seems like a bug. The seed is still available by digging through the returned modelContext as a work around

@danmarshall
Copy link
Contributor

Thanks for posting, can you provide a small repro?

@ggoodkey
Copy link
Contributor Author

https://github.com/ggoodkey/unify-bezier

or in the playground

var makerjs = require('makerjs');

this.models = {};
this.models.curve = {
  models:{
    curve1: new makerjs.models.BezierCurve([0, 0], [25, 35], [30, -10], [50, 0]),
    curve2: new makerjs.models.BezierCurve([50, 0], [75, 35], [80, -10], [100, 0])
  }
};

var text = "";
makerjs.model.findChains(this.models.curve, function (chains, loose, layer, ignored) {
  for (var a = 0; a < chains.length; a++) {
    for (var b = 0; b < chains[a].links.length; b++) {
      text = chains[a].links[b].walkedPath.pathContext.type;
      this.models['text_' + b] = {};
      makerjs.model.addCaption(this.models['text_' + b], text, [0, -10 * (b + 1)], [100, -10 * (b + 1)]);
    }
  }
}.bind(this), { unifyBeziers: true });

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

No branches or pull requests

2 participants