|
@@ -34,6 +34,8 @@ IGL_INLINE bool igl::is_edge_manifold(
|
|
|
// Find unique undirected edges and mapping
|
|
// Find unique undirected edges and mapping
|
|
|
VectorXF _;
|
|
VectorXF _;
|
|
|
unique_simplices(allE,E,_,EMAP);
|
|
unique_simplices(allE,E,_,EMAP);
|
|
|
|
|
+ // could use "face_occurrences.h", but that implementation uses
|
|
|
|
|
+ // vector<vector>>
|
|
|
std::vector<typename DerivedF::Index> count(E.rows(),0);
|
|
std::vector<typename DerivedF::Index> count(E.rows(),0);
|
|
|
for(Index e = 0;e<EMAP.rows();e++)
|
|
for(Index e = 0;e<EMAP.rows();e++)
|
|
|
{
|
|
{
|
|
@@ -56,49 +58,16 @@ template <typename DerivedF>
|
|
|
IGL_INLINE bool igl::is_edge_manifold(
|
|
IGL_INLINE bool igl::is_edge_manifold(
|
|
|
const Eigen::MatrixBase<DerivedF>& F)
|
|
const Eigen::MatrixBase<DerivedF>& F)
|
|
|
{
|
|
{
|
|
|
- // TODO: It's bothersome that this is not calling/reusing the code from the
|
|
|
|
|
- // overload above. This could result in disagreement.
|
|
|
|
|
-
|
|
|
|
|
- // List of edges (i,j,f,c) where edge i<j is associated with corner i of face
|
|
|
|
|
- // f
|
|
|
|
|
- std::vector<std::vector<int> > TTT;
|
|
|
|
|
- for(int f=0;f<F.rows();++f)
|
|
|
|
|
- for (int i=0;i<3;++i)
|
|
|
|
|
- {
|
|
|
|
|
- // v1 v2 f ei
|
|
|
|
|
- int v1 = F(f,i);
|
|
|
|
|
- int v2 = F(f,(i+1)%3);
|
|
|
|
|
- if (v1 > v2) std::swap(v1,v2);
|
|
|
|
|
- std::vector<int> r(4);
|
|
|
|
|
- r[0] = v1; r[1] = v2;
|
|
|
|
|
- r[2] = f; r[3] = i;
|
|
|
|
|
- TTT.push_back(r);
|
|
|
|
|
- }
|
|
|
|
|
- // Sort lexicographically
|
|
|
|
|
- std::sort(TTT.begin(),TTT.end());
|
|
|
|
|
-
|
|
|
|
|
- for(int i=2;i<(int)TTT.size();++i)
|
|
|
|
|
- {
|
|
|
|
|
- // Check any edges occur 3 times
|
|
|
|
|
- std::vector<int>& r1 = TTT[i-2];
|
|
|
|
|
- std::vector<int>& r2 = TTT[i-1];
|
|
|
|
|
- std::vector<int>& r3 = TTT[i];
|
|
|
|
|
- if ( (r1[0] == r2[0] && r2[0] == r3[0])
|
|
|
|
|
- &&
|
|
|
|
|
- (r1[1] == r2[1] && r2[1] == r3[1]) )
|
|
|
|
|
- {
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return true;
|
|
|
|
|
|
|
+ Eigen::Array<bool,Eigen::Dynamic,Eigen::Dynamic> BF;
|
|
|
|
|
+ Eigen::Array<bool,Eigen::Dynamic,1> BE;
|
|
|
|
|
+ Eigen::MatrixXi E;
|
|
|
|
|
+ Eigen::VectorXi EMAP;
|
|
|
|
|
+ return is_edge_manifold(F,BF,E,EMAP,BE);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#ifdef IGL_STATIC_LIBRARY
|
|
#ifdef IGL_STATIC_LIBRARY
|
|
|
// Explicit template instantiation
|
|
// Explicit template instantiation
|
|
|
-// generated by autoexplicit.sh
|
|
|
|
|
template bool igl::is_edge_manifold<Eigen::Matrix<unsigned int, -1, -1, 1, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<unsigned int, -1, -1, 1, -1, -1> > const&);
|
|
template bool igl::is_edge_manifold<Eigen::Matrix<unsigned int, -1, -1, 1, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<unsigned int, -1, -1, 1, -1, -1> > const&);
|
|
|
-// generated by autoexplicit.sh
|
|
|
|
|
-//template bool igl::is_edge_manifold<double>(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&);
|
|
|
|
|
template bool igl::is_edge_manifold<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
|
|
template bool igl::is_edge_manifold<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
|
|
|
template bool igl::is_edge_manifold<Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&);
|
|
template bool igl::is_edge_manifold<Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&);
|
|
|
#endif
|
|
#endif
|