Coder Social home page Coder Social logo

infinite loop in CollapseEdge about manifold HOT 6 CLOSED

elalish avatar elalish commented on July 19, 2024
infinite loop in CollapseEdge

from manifold.

Comments (6)

pca006132 avatar pca006132 commented on July 19, 2024 1

yes, I will add this after writing the fuzzing prototype

from manifold.

elalish avatar elalish commented on July 19, 2024 1

Thanks, I managed to simplify your first repro yesterday and I see where the problem is. Hopefully I'll have it fixed soon.

from manifold.

elalish avatar elalish commented on July 19, 2024

Thanks! Would you like to add this to mest_test? We can just put DISABLED_ in front of the name so the CI passes until we manage to debug it.

from manifold.

pca006132 avatar pca006132 commented on July 19, 2024

Did some debugging with this (learning to use rr), it seems that current becomes -1 after executing line 248, and then just produce a cycle of 1, 37, 11, 18, 67, 21. I guess -1 means that the edge should be removed?

while (current != tri1edge[2]) {
current = NextHalfedge(current);
edges.push_back(current);
current = halfedge[current].pairedHalfedge;
}

from manifold.

elalish avatar elalish commented on July 19, 2024

Thanks! I'd say -1 generally means something went wrong (it should probably be asserted, ideally). I'll take a look; I usually have to draw out the topology on paper to figure out where my bad assumption is.

from manifold.

pca006132 avatar pca006132 commented on July 19, 2024

it seems that the following change to master will also trigger this bug for Samples.Frame test:

diff --git a/manifold/src/impl.cpp b/manifold/src/impl.cpp
index 9b5513b..ea91a60 100644
--- a/manifold/src/impl.cpp
+++ b/manifold/src/impl.cpp
@@ -134,7 +134,7 @@ struct SwapHalfedges {
   Halfedge* halfedges;
   const TmpEdge* edges;
 
-  __host__ void operator()(int k) {
+  __host__ __device__ void operator()(int k) {
     const int i = 2 * k;
     const int j = i - 2;
     const TmpEdge thisEdge = edges[i];
@@ -519,10 +519,10 @@ void Manifold::Impl::CreateAndFixHalfedges(const VecDH<glm::ivec3>& triVerts) {
   // and fix it by swapping one of the identical edges, so it is important that
   // we have the edges paired according to their face.
   thrust::stable_sort(thrust::device, edge.begin(), edge.end());
-  thrust::for_each_n(thrust::host, countAt(0), halfedge_.size() / 2,
-                     LinkHalfedges({halfedge_.ptrH(), edge.cptrH()}));
-  thrust::for_each(thrust::host, countAt(1), countAt(halfedge_.size() / 2),
-                   SwapHalfedges({halfedge_.ptrH(), edge.cptrH()}));
+  thrust::for_each_n(thrust::device, countAt(0), halfedge_.size() / 2,
+                     LinkHalfedges({halfedge_.ptrD(), edge.cptrD()}));
+  thrust::for_each(thrust::device, countAt(1), countAt(halfedge_.size() / 2),
+                   SwapHalfedges({halfedge_.ptrD(), edge.cptrD()}));
 }

from manifold.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.