cell_adjacency.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 Qingnan Zhou <qnzhou@gmail.com>
  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::PlainObjectBase<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. template void igl::copyleft::cgal::cell_adjacency<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, unsigned long, std::vector<std::set<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, unsigned long>, std::less<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, unsigned long> >, std::allocator<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, unsigned long> > >, std::allocator<std::set<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, unsigned long>, std::less<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, unsigned long> >, std::allocator<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, unsigned long> > > > >&);
  27. #endif