jasonrhansen / cut-optimizer-2d

2D Cut Optimizer
Apache License 2.0
24 stars 11 forks source link

Guillotine Cut Error #20

Open yoosef opened 2 years ago

yoosef commented 2 years ago

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": [] } ] }