7 #include <igl/bfs_orient.h>
8 #if defined(__GNUG__) && !defined(__clang__)
9 #pragma GCC diagnostic push
10 #pragma GCC diagnostic ignored "-Warray-bounds"
12 #include <igl/fast_winding_number.h>
13 #include <igl/winding_number.h>
14 #if defined(__GNUG__) && !defined(__clang__)
15 #pragma GCC diagnostic pop
27 Eigen::MatrixX<Rational> m_pos_rational, surface_pos_rational;
28 Eigen::MatrixXd m_pos, surface_pos;
32 assert(m_pos_rational.cols() == 3);
33 m_pos.resize(m_pos_rational.rows(), m_pos_rational.cols());
35 m_pos = m_pos_rational.cast<
double>();
37 surface_pos.resize(surface_pos_rational.rows(), surface_pos_rational.cols());
38 surface_pos = surface_pos_rational.cast<
double>();
53 default:
throw std::runtime_error(
"Unsupported Mesh Type");
58 Eigen::MatrixXd centroids;
59 centroids.resize(m_FV.rows(), 3);
61 for (int64_t i = 0; i < m_FV.rows(); ++i) {
63 for (int64_t j = 0; j < m_FV.cols(); ++j) {
64 Vector3d v_pos = m_pos.row(m_FV(i, j));
65 centroid = centroid + v_pos;
67 centroids.row(i) = centroid / m_FV.cols();
72 igl::bfs_orient(surface_FV, surface_FV, _C);
75 return winding_numbers;
79 const Eigen::MatrixXd& query_points,
80 const Eigen::MatrixXd& surface_V,
83 Eigen::VectorXd winding_numbers;
84 igl::fast_winding_number(surface_V, surface_F, query_points, winding_numbers);
85 return winding_numbers;
void serialize(MeshWriter &writer, const Mesh *local_root=nullptr) const
PrimitiveType top_simplex_type() const
void get_position_matrix(MatrixX< double > &matrix)
void get_EV_matrix(MatrixX< int64_t > &matrix)
void get_TV_matrix(MatrixX< int64_t > &matrix)
void get_FV_matrix(MatrixX< int64_t > &matrix)
Eigen::VectorXd winding_number(const Mesh &m, const TriMesh &surface)
Eigen::VectorXd winding_number_internal(const Eigen::MatrixXd &query_points, const Eigen::MatrixXd &surface_V, const MatrixX< int64_t > &surface_F)
Vector< double, 3 > Vector3d
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > MatrixX