textiles-lab / autoknit

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

Adding first constraint crashes interface #2

Open cppietime opened 5 years ago

cppietime commented 5 years ago

I attempted to run interface.exe on Windows, and it properly displayed the model, but as soon as I tried to add a constraint by pressing c, the program crashed and gave me this output:

WARNING: unknown object command 's'
(the above line repeated an obscene number of times)
Read 11877 vertices and 17348 triangles from 'C:/users/owner/Documents/ltest.obj'.
WARNING: had to triangulate 1212 faces.
WARNING: have 1212 topologically degenerate and 1212 numerically degenerate triangles. This is likely to mess things up!
WARNING: have 1262 oriented edges that appear more than once; this means the mesh is probably not an orientable manifold, which is likely to mess things up!
Setting up various buffer bindings.
WARNING: pointer didn't move during Move action.
Max edge length: 1.73 model units.
Assertion failed: tri.x != tri.y && tri.x != tri.z && tri.y != tri.z, file ak-embed_constraints.cpp, line 123

Attempting to open the file again using the same model and constraint files cause it to immediately crash. Is this because the model being used cannot be processed by the program, or is this some sort of bug?

ixchow commented 5 years ago

Hmm. The code is splitting faces with more than three edges into triangles, then encountering some badly formed triangles. So it could be that the triangle-splitting code isn't doing the right thing; however, a work-around would be to make sure the model being loaded only has triangular faces (e.g., run the "triangulate" command if processing the model in Blender).

ixchow commented 5 years ago

For what it's worth, there was an obvious bug in the triangulation code, which I have now either fixed or turned into a less obvious bug.

cppietime commented 5 years ago

Messing with blender a little let me get it to avoid crashing and complaining that "this might mess things up", however, the interface still becomes far too slow and unresponsive to ever be usable as soon as the first constraint is added, i.e., the program spends 30 seconds unresponsive, updates the frame, repeats this a few times, then places the constraint somewhere other than where the cursor was/is.

ixchow commented 5 years ago

Agreed; performance on large models isn't great -- it should probably be recomputing the mesh trimming on a background thread so that it doesn't feel as laggy.