textiles-lab / autoknit

A public-domain reimplementation of autoknit (3D mesh -> machine knitting pattern).
144 stars 29 forks source link

bunny crash #10

Open gabrielle-ohlson opened 3 years ago

gabrielle-ohlson commented 3 years ago

I was met with the following assert() failure when attempting to save the traced stitches generated using the bunny.obj file:

Assertion failed: vertices[vertices[at].col_in[0]].col_out[0] != -1U && vertices[vertices[at].col_in[0]].col_out[1] != -1U, file ak-trace_graph.cpp, line 152

here's the full command I ran:

./interface.exe obj:../autoknit-tests/models/bunny.obj constraints:../autoknit-tests/constraints/bunny.cons peel-step:-1 save-traced:bunny.st

(note: it ran for a long time and outputted a good deal of messages before crashing with an error number [9])

gabrielle-ohlson commented 3 years ago

fiddled with obj-scale: and stitch-width:/stitch-height: args and now thinking the issue had to do with that...

with the command:

./interface.exe obj:../autoknit-tests/models/bunny.obj constraints:../autoknit-tests/constraints/bunny.cons stitch-width:2.0 stitch-height:2.0 peel-step:-1 save-traced:bunny.st

the program runs for a long time again (still running, will update, but hasn't crashed yet) <—UPDATE: just finished running (took ~30-40 minutes), and bunny.st was successfully generated.

and then with the command:

./interface.exe obj:../autoknit-tests/models/bunny.obj constraints:../autoknit-tests/constraints/bunny.cons obj-scale:0.5 save-traced:bunny.st

^TODO: try this <—UPDATE: just finished running (took ~1 min); bunny.st was also successfully generated with this combination of args.

gabrielle-ohlson commented 3 years ago

might be worth adding documentation on which obj-scale and stitch- values work best with each example model (see autoknit-tests issue 1)

vid8687 commented 3 years ago

obj-scale and stitch-width/height values are based on the fabrication setup, the object is measured in mms and stitch-width and height values in mms should be measured for a half-gauge swatch. (If the system fails for any combination of these values, it is a bug)

ixchow commented 3 years ago

:arrow_forward: If the system fails for any combination of these values, it is a bug :arrow_backward:

(I strongly agree; well said, @vid8687)

gabrielle-ohlson commented 3 years ago

sounds reasonable to be.

this command with stitch-width:2.0 stitch-height:2.0 just finished running (took probably 30-40 minutes), but it did successfully generate a bunny.st file.

UPDATE: obj-scale:0.5 also worked (and only took ~1 min)

so looks like it does work for some scale/stitch combinations, but not all.

vid8687 commented 3 years ago

I fixed the tracing code to avoid tucking on empty needles that fixes this (haven't extensively tested this, so not closing yet), @gabrielle-ohlson does the most recent version of the code fix all the problematic cases you found?

ixchow commented 2 years ago

The code still hits an assertion when running:

dist/interface obj:../autoknit-tests/models/bunny.obj load-constraints:../autoknit-tests/constraints/bunny.cons peel-step:480

(Use peel-step:479 to see the model just before the assert.)

The assertion is:

interface: ak-peel_slice-euclidean.cpp:221: void ak::peel_slice(const ak::Parameters&, const ak::Model&, const std::vector<std::vector<ak::EmbeddedVertex> >&, ak::Model*, std::vector<ak::EmbeddedVertex>*, std::vector<std::vector<unsigned int> >*, std::vector<std::vector<unsigned int> >*, std::vector<bool>*): Assertion `level_chains[c].empty()' failed.

Looks like this is a different error, but causing the same problem (bunny not working).