std::vector> VV; igl::adjacency_list(F, VV); int a = 0, b = 0; double distance = 0; // Loop through all verts, perform distance measure for(int i=0; i> queue; std::unordered_set visited; queue.push_back(std::make_tuple(i, 0)); // While we have neighbours to investigate... while(!queue.empty()){ std::tie(v, d) = queue.back(); visited.emplace(v); queue.pop_back(); // Go through neighbours of this and, if not found yet, enqueue for(int j : VV[v]){ if(visited.count(j) <= 0) queue.push_back(std::make_tuple(j, d+1)); } // Check furthest. if(distance < d){ distance = d; a = i; b = v; } } } // Store. std::cout << "Fixpoints: " << a << "," << b << " (" << distance << ")\n"; fixed_UV_indices = Eigen::VectorXi::Zero(2); fixed_UV_positions = Eigen::MatrixXd::Zero(2, 2); fixed_UV_indices(0) = a; fixed_UV_indices(1) = b; fixed_UV_positions(0, 0) = -0.5; fixed_UV_positions(1, 0) = +0.5;