gradientspace / geometry3Sharp

C# library for 2D/3D geometric computation, mesh algorithms, and so on. Boost license.
http://www.gradientspace.com
Boost Software License 1.0
1.71k stars 384 forks source link

[Bug] Problem in MeshMeshCut (with fix) #138

Open CBenghi opened 4 years ago

CBenghi commented 4 years ago

Hi @rms80,

I think I've spotted a bug in MeshMeshCut at the following line:

https://github.com/gradientspace/geometry3Sharp/blob/79829341d6c225375128c32cd4720dd48f970c6e/mesh_ops/MeshMeshCut.cs#L208

The code is looking for the wrong coordinate. It should be looking for v, which was previously assigned at the beginning of the loop.

The obvious fix is:

int existing_v = find_existing_vertex(v);

Let me know if you prefer a PR. Best, Claudio

48design commented 3 years ago

Thanks for reporting! From my tests the results are identical but your fix seems to be absolutely right as both points inside the Vector3dTuple2 (which we loop through) should be tested, not only the first one. There seem to be more bugs inside MeshMeshCut (like the missing points in CutVertices list) which I am trying to fix at the moment. Input is appreciated!