1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- // This file is part of libigl, a simple c++ geometry processing library.
- //
- // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
- //
- // 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 "is_edge_manifold.h"
- #include <algorithm>
- template <typename DerivedV, typename DerivedF>
- IGL_INLINE bool igl::is_edge_manifold(const Eigen::PlainObjectBase<DerivedV>& /*V*/,
- const Eigen::PlainObjectBase<DerivedF>& 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);
- }
- std::sort(TTT.begin(),TTT.end());
-
- for(int i=2;i<(int)TTT.size();++i)
- {
- 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;
- }
- #ifdef IGL_STATIC_LIBRARY
- // Explicit template specialization
- // generated by autoexplicit.sh
- template bool igl::is_edge_manifold<Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<unsigned int, -1, -1, 1, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<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<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
- #endif
|