// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2016 Qingnan Zhou // // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. // #include "relabel_small_immersed_cells.h" #include "../../centroid.h" #include "assign.h" #include "cell_adjacency.h" #include template< typename DerivedV, typename DerivedF, typename DerivedP, typename DerivedC, typename FT, typename DerivedW> IGL_INLINE void igl::copyleft::cgal::relabel_small_immersed_cells( const Eigen::PlainObjectBase& V, const Eigen::PlainObjectBase& F, const size_t num_patches, const Eigen::PlainObjectBase& P, const size_t num_cells, const Eigen::PlainObjectBase& C, const FT vol_threashold, Eigen::PlainObjectBase& W) { const size_t num_vertices = V.rows(); const size_t num_faces = F.rows(); typedef std::tuple CellConnection; std::vector > cell_adj; igl::copyleft::cgal::cell_adjacency(C, num_cells, cell_adj); Eigen::MatrixXd VV; assign(V,VV); auto compute_cell_volume = [&](size_t cell_id) { std::vector is_involved(num_patches, 0); for (size_t i=0; i involved_positive_faces; std::vector involved_negative_faces; for (size_t i=0; i cell_volumes(num_cells); for (size_t i=0; i cell_values(num_cells); for (size_t i=0; i= vol_threashold) continue; std::set neighbor_values; const auto neighbors = cell_adj[i]; for (const auto& entry : neighbors) { const auto& j = std::get<0>(entry); neighbor_values.insert(cell_values[j]); } // If cell i is immersed, assign its value to be the immersed value. if (neighbor_values.size() == 1) { cell_values[i] = *neighbor_values.begin(); } } for (size_t i=0; i