diff --git a/CMakeLists.txt b/CMakeLists.txt index be1e677..7aeb18d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ option(BUILD_DOC "Build documentation" ON) option(BUILD_WITH_MARCH_NATIVE "Build with flag march=native" OFF) option(ENABLE_MKL "Try to use Eigen with MKL" OFF) option(ENABLE_DIAGNOSTIC_PRINT "Enable printing of diagnostic messages" ON) +option(TEASERPP_USE_EXTERNAL_TINPLY "Use an external tinyply library instead of the internal one." OFF) if (ENABLE_DIAGNOSTIC_PRINT) message(STATUS "Enable printing of diagnostic messages.") diff --git a/cmake/pybind11.CMakeLists.txt.in b/cmake/pybind11.CMakeLists.txt.in deleted file mode 100644 index e62ac51..0000000 --- a/cmake/pybind11.CMakeLists.txt.in +++ /dev/null @@ -1,15 +0,0 @@ -cmake_minimum_required(VERSION 3.10) - -project(pybind11-download NONE) - -include(ExternalProject) -ExternalProject_Add(pmc - GIT_REPOSITORY https://github.com/pybind/pybind11.git - GIT_TAG v2.13.6 - SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/pybind11-src" - BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/pybind11-build" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - ) diff --git a/teaser/CMakeLists.txt b/teaser/CMakeLists.txt index b96e2f3..5197712 100644 --- a/teaser/CMakeLists.txt +++ b/teaser/CMakeLists.txt @@ -12,13 +12,15 @@ if (NOT pmc_POPULATED) add_subdirectory(${pmc_SOURCE_DIR} ${pmc_BINARY_DIR} EXCLUDE_FROM_ALL) endif() -FetchContent_Declare(tinyply - GIT_REPOSITORY https://github.com/ddiakopoulos/tinyply.git - BUILD_COMMAND "" - INSTALL_COMMAND "" -) -if (NOT tinyply_POPULATED) - FetchContent_Populate(tinyply) +if(NOT TEASERPP_USE_EXTERNAL_TINPLY) + FetchContent_Declare(tinyply + GIT_REPOSITORY https://github.com/ddiakopoulos/tinyply.git + BUILD_COMMAND "" + INSTALL_COMMAND "" + ) + if (NOT tinyply_POPULATED) + FetchContent_Populate(tinyply) + endif() endif() FetchContent_Declare(spectra diff --git a/teaser/include/teaser/graph.h b/teaser/include/teaser/graph.h index e7ab542..feadf99 100644 --- a/teaser/include/teaser/graph.h +++ b/teaser/include/teaser/graph.h @@ -41,7 +41,6 @@ class Graph { adj_list_.resize(adj_list.size()); num_edges_ = 0; for (const auto& e_list : adj_list) { - const auto& v = e_list.first; adj_list_[e_list.first] = e_list.second; num_edges_ += e_list.second.size(); } diff --git a/teaser/src/graph.cc b/teaser/src/graph.cc index 5ed4872..953218c 100644 --- a/teaser/src/graph.cc +++ b/teaser/src/graph.cc @@ -51,7 +51,7 @@ std::vector teaser::MaxCliqueSolver::findMaxClique(teaser::Graph graph) { in.heu_strat = "kcore"; in.vertex_search_order = "deg"; - // vector to represent max clique + // std::vector to represent max clique std::vector C; // upper-bound of max clique @@ -69,7 +69,7 @@ std::vector teaser::MaxCliqueSolver::findMaxClique(teaser::Graph graph) { static_cast(all_vertices.size()))) { TEASER_DEBUG_INFO_MSG("Using K-core heuristic finder."); // remove all nodes with core number less than max core number - // k_cores is a vector saving the core number of each vertex + // k_cores is a std::vector saving the core number of each vertex auto k_cores = G.get_kcores(); for (int i = 1; i < k_cores->size(); ++i) { // Note: k_core has size equals to num vertices + 1 diff --git a/test/teaser/graph-test.cc b/test/teaser/graph-test.cc index 238f4c8..5bc8925 100644 --- a/test/teaser/graph-test.cc +++ b/test/teaser/graph-test.cc @@ -7,15 +7,14 @@ */ #include "gtest/gtest.h" -#include "gmock/gmock.h" #include #include #include "pmc/pmc.h" +#include "pmc/pmc_bool_vector.h" #include "pmc/pmc_input.h" #include "teaser/graph.h" -#include "test_utils.h" /** * A helper function to generate mock input for testing PMC code @@ -47,11 +46,11 @@ pmc::input generateMockInput() { * @param adj a bool** to the adjcency matrix * @param nodes number of nodes in the graph */ -void printAdjMatirx(const std::vector>& adj, int nodes) { +void printAdjMatirx(const std::vector& adj, int nodes) { std::cout << "Adjacency matrix: " << std::endl; - for (auto& i : adj) { - for (auto j : i) { - std::cout << j << " "; + for (const auto& row : adj) { + for (std::size_t i = 0; i < row.size(); ++i) { + std::cout << row[i] << " "; } std::cout << std::endl; } diff --git a/test/teaser/registration-test.cc b/test/teaser/registration-test.cc index ba357c7..2034555 100644 --- a/test/teaser/registration-test.cc +++ b/test/teaser/registration-test.cc @@ -188,7 +188,7 @@ TEST(RegistrationTest, SolveForRotation) { params.rotation_gnc_factor = 1.4; params.rotation_estimation_algorithm = teaser::RobustRegistrationSolver::ROTATION_ESTIMATION_ALGORITHM::QUATRO; - params.inlier_selection_mode == + params.inlier_selection_mode = teaser::RobustRegistrationSolver::INLIER_SELECTION_MODE::PMC_HEU; params.rotation_cost_threshold = 0.005; @@ -454,13 +454,12 @@ TEST(RegistrationTest, OutlierDetection) { auto solution = solver.getSolution(); EXPECT_LE(teaser::test::getAngularError(T.topLeftCorner(3, 3), solution.rotation), 0.2); - EXPECT_LE((T.topRightCorner(3, 1) - solution.translation).norm(), 0.1); + EXPECT_LE((T.topRightCorner(3, 1) - solution.translation).squaredNorm(), 0.01); auto final_inliers = solver.getInlierMaxClique(); - - EXPECT_EQ(expected_inliers.size(), final_inliers.size()); - std::sort(expected_inliers.begin(), expected_inliers.end()); std::sort(final_inliers.begin(), final_inliers.end()); + + ASSERT_EQ(expected_inliers.size(), final_inliers.size()); for (size_t i = 0; i < expected_inliers.size(); ++i) { EXPECT_EQ(expected_inliers[i], final_inliers[i]); }