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

Guillotine Cut Error #20

Open
yoosef opened this issue Sep 24, 2022 · 0 comments
Open

Guillotine Cut Error #20

yoosef opened this issue Sep 24, 2022 · 0 comments

Comments

@yoosef
Copy link

yoosef commented Sep 24, 2022

I'm reviewing this guillotine cut in javascript using wasm-pack. The guillotine cut result is not correct on the version 4.2, while it was correct on 1.5 !
Could you help where is my wrong?

const wasm = await import('cut-optimizer-2d-web');
const opt = new wasm.Optimizer();
opt.addStockPiece(1000, 1000, 0);
opt.addStockPiece(1500, 3000, 0);
opt.addCutPiece(1, 1000, 1000, false, 0);
opt.addCutPiece(2, 1000, 1000, false, 0);
opt.addCutPiece(3, 500, 2000, false, 0);
opt.addCutPiece(4, 500, 2000, false, 0);
opt.addCutPiece(5, 500, 1000, false, 0);
opt.setCutWidth(0);
opt.setRandomSeed(0.4);
const res = opt.optimizeGuillotine((a) => {});

this code give me this wrong result which is not guillotine!

{
"fitness": 1,
"stockPieces": [
{
"width": 1500,
"length": 3000,
"patternDirection": "none",
"cutPieces": [
{
"externalId": 2,
"x": 0,
"y": 0,
"width": 1000,
"length": 1000,
"patternDirection": "none",
"isRotated": false
},
{
"externalId": 3,
"x": 0,
"y": 1000,
"width": 500,
"length": 2000,
"patternDirection": "none",
"isRotated": false
},
{
"externalId": 5,
"x": 500,
"y": 1000,
"width": 500,
"length": 1000,
"patternDirection": "none",
"isRotated": false
},
{
"externalId": 4,
"x": 1000,
"y": 0,
"width": 500,
"length": 2000,
"patternDirection": "none",
"isRotated": false
},
{
"externalId": 1,
"x": 500,
"y": 2000,
"width": 1000,
"length": 1000,
"patternDirection": "none",
"isRotated": false
}
],
"wastePieces": []
}
]
}

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

1 participant