cell_adjacency.cpp 1.8 KB

1234567891011121314151617181920212223242526272829303132
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 Qingnan Zhou <[email protected]>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. //
  9. #include "cell_adjacency.h"
  10. template <typename DerivedC>
  11. IGL_INLINE void igl::copyleft::cgal::cell_adjacency(
  12. const Eigen::MatrixBase<DerivedC>& per_patch_cells,
  13. const size_t num_cells,
  14. std::vector<std::set<std::tuple<typename DerivedC::Scalar, bool, size_t> > >&
  15. adjacency_list) {
  16. const size_t num_patches = per_patch_cells.rows();
  17. adjacency_list.resize(num_cells);
  18. for (size_t i=0; i<num_patches; i++) {
  19. const int positive_cell = per_patch_cells(i,0);
  20. const int negative_cell = per_patch_cells(i,1);
  21. adjacency_list[positive_cell].emplace(negative_cell, false, i);
  22. adjacency_list[negative_cell].emplace(positive_cell, true, i);
  23. }
  24. }
  25. #ifdef IGL_STATIC_LIBRARY
  26. // Explicit template instantiation
  27. template void igl::copyleft::cgal::cell_adjacency<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, size_t, std::vector<std::set<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, size_t>, std::less<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, size_t> >, std::allocator<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, size_t> > >, std::allocator<std::set<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, size_t>, std::less<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, size_t> >, std::allocator<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, size_t> > > > >&);
  28. #endif