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

Unexpected subtract behaviour #463

Open
Naas-Mark opened this issue May 4, 2020 · 0 comments
Open

Unexpected subtract behaviour #463

Naas-Mark opened this issue May 4, 2020 · 0 comments
Labels

Comments

@Naas-Mark
Copy link

Naas-Mark commented May 4, 2020

Version 0.17 (NPM)

While using this library I stumbled upon the following unexpected result after subtracting a square model from two concentric circles:

image

The result should be:

image

Code to reproduce in the playground:

var makerjs = require('makerjs');

var rectangle = {
  paths: {
    top: new makerjs.paths.Line([-84, 226], [-82, -7]),
    bottom: new makerjs.paths.Line([32.5,227], [34.5, -6]),
    left: new makerjs.paths.Line([32.5, 227], [-84, 226]),
    right: new makerjs.paths.Line([-82,-7], [34.5,-6])
  }
};

var concentricCirles = {
  paths: {
    outerCircle: new makerjs.paths.Circle([0.5, 2], 194.005),
    innerCircle: new makerjs.paths.Circle([1.5, -0], 162)
  }
};
    
var cut = makerjs.model.combineSubtraction(concentricCirles, rectangle);

var svg = makerjs.exporter.toSVG(cut);

document.write(svg);

When making a straight rectangle, problem seems to disappear:

var rectangle = {
    	paths: {
		top: new makerjs.paths.Line([-75, 226], [-75, -5]),
      		bottom: new makerjs.paths.Line([35,225], [35, -5]),
      		left: new makerjs.paths.Line([35, 225], [-75, 225]),
      		right: new makerjs.paths.Line([-75,-5], [34.5,-5])
	}
};
@danmarshall danmarshall added the bug label May 4, 2020
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