Figured out way to separate the boundary of a mesh from the defects (using orientation). Till initization of the priority queue works fine (finding free edge chain, finding closest edge for those, calculating error and inserting into the priority queue. Memory corruption error with the zipperGaps() function. I'm trying to resolve it.
Some general remarks:
- Memory allocated with new should be freed with delete. There might be a compiler which doesn't like free() here.
- Don't make a riddle from your parameters. If the function expects an array of 3 doubles you can write it down so, e.g. "double A[3]" as you did for the matrix. Furthermore give the parameters convincing names: What is A, B, and C in shortestDistToLine()?
- In C++ you can use references for passing parameters as references, e.g. "DCELEdge& edge" or "const DCELEdge& edge" instead of "DCELEdge edge". And use "const" as much as possible. It's a good indicator on what the function does, i.e. changing this value or not.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Quite a few memory errors popped up. I solved all but one. An error popping up with the push operation to the priority queue. I'm reading up about it. And simultaneously outlining the stitching algo as well.
Coded the rest of the stitching algorithm. Included a part in the zippering gaps algorithm to accommodate for gaps that are square in shape (in which case none of the vertices on the chain would have any valid feature - hence it needs to be treated separately). Changed some function parameters to const as suggested.
Zippering gaps modified to include boundary edges. bool vector is used to avoid multiple checks to the same chain of edges. Stitching gaps algo modified slightly. Zippering - vertex contraction has not been done right. Debugging.
deleteEdge() function changed to cope with the degeneracy wrt orientation. Works fine. Checking the functions that might be causing the memory issues. Added changes to stitching algorithm.
Memory issues resolved. Found cases where triangles might cross over each other due to the transformations. Thus, need to check if the orientation of the triangle changes. Changes made in the rt_bot_internal struct pointer not being reflected with draw. Need to figure out.
Changes could be seen using 'draw' and 'analyze'. But with distorted triangles. Changes for orientation check was added. Works. Few more cases of erroneous detection of feature edges, Looking into them.
Had to test a few times with a mesh that needs no healing. Made changes for the case when the defect is a square (the normal case does not work, special case was written for a square) - works fine. Created two disconnected hemispheres on Blender to test, and exported the geometry as an .obj file. Testing it.
Patch updated as mentioned in the mail.
Patch as of 23/6/16
Patch after modifying the closest edge function. Parts yet to be corrected - like checking if a line cuts a triangle.
Figured out way to separate the boundary of a mesh from the defects (using orientation). Till initization of the priority queue works fine (finding free edge chain, finding closest edge for those, calculating error and inserting into the priority queue. Memory corruption error with the zipperGaps() function. I'm trying to resolve it.
Made changes in the zipperGaps() function. Tested them. Errors in logic still exist in some of them. Looking into it.
Rectifying errors with modifying the DCEL.
Still modifying DCEL access functions.
Some general remarks:
- Memory allocated with new should be freed with delete. There might be a compiler which doesn't like free() here.
- Don't make a riddle from your parameters. If the function expects an array of 3 doubles you can write it down so, e.g. "double A[3]" as you did for the matrix. Furthermore give the parameters convincing names: What is A, B, and C in shortestDistToLine()?
- In C++ you can use references for passing parameters as references, e.g. "DCELEdge& edge" or "const DCELEdge& edge" instead of "DCELEdge edge". And use "const" as much as possible. It's a good indicator on what the function does, i.e. changing this value or not.
Patch as of 2/7/16.
Quite a few issue with the zipperig that i haven't figured out yet. Coding the stitching algorithm simultaneously.
What are these issues? How can I reproduce them?
Quite a few memory errors popped up. I solved all but one. An error popping up with the push operation to the priority queue. I'm reading up about it. And simultaneously outlining the stitching algo as well.
Example geometry
The name of the sample mesh is "samplebot.s"
Coded the rest of the stitching algorithm. Included a part in the zippering gaps algorithm to accommodate for gaps that are square in shape (in which case none of the vertices on the chain would have any valid feature - hence it needs to be treated separately). Changed some function parameters to const as suggested.
Zippering gaps modified to include boundary edges. bool vector is used to avoid multiple checks to the same chain of edges. Stitching gaps algo modified slightly. Zippering - vertex contraction has not been done right. Debugging.
Patch as of 11/7/16
deleteEdge() function changed to cope with the degeneracy wrt orientation. Works fine. Checking the functions that might be causing the memory issues. Added changes to stitching algorithm.
Memory issues resolved. Found cases where triangles might cross over each other due to the transformations. Thus, need to check if the orientation of the triangle changes. Changes made in the rt_bot_internal struct pointer not being reflected with draw. Need to figure out.
Changes could be seen using 'draw' and 'analyze'. But with distorted triangles. Changes for orientation check was added. Works. Few more cases of erroneous detection of feature edges, Looking into them.
Zippering gaps module.
Had to test a few times with a mesh that needs no healing. Made changes for the case when the defect is a square (the normal case does not work, special case was written for a square) - works fine. Created two disconnected hemispheres on Blender to test, and exported the geometry as an .obj file. Testing it.
Test results till now.
Thanks for sharing the results! That's looking pretty darn good... Do you think its in a stable state where you could try healing a real model yet?
Not yet, Sean. I'm testing with as many meshes as possible, so that there are no stones left unturned. :)