|
@@ -13,19 +13,31 @@
|
|
|
#include <algorithm>
|
|
|
#include <iostream>
|
|
|
|
|
|
-template <typename Scalar, typename Index>
|
|
|
-IGL_INLINE void igl::triangle_triangle_adjacency_preprocess(
|
|
|
- const Eigen::PlainObjectBase<Scalar>& /*V*/,
|
|
|
- const Eigen::PlainObjectBase<Index>& F,
|
|
|
- std::vector<std::vector<int> >& TTT)
|
|
|
+// Extract the face adjacencies
|
|
|
+template <typename DerivedF, typename TTT_type, typename DerivedTT>
|
|
|
+IGL_INLINE void igl::triangle_triangle_adjacency_extractTT(
|
|
|
+ const Eigen::PlainObjectBase<DerivedF>& F,
|
|
|
+ std::vector<std::vector<TTT_type> >& TTT,
|
|
|
+ Eigen::PlainObjectBase<DerivedTT>& TT)
|
|
|
{
|
|
|
- return triangle_triangle_adjacency_preprocess(F,TTT);
|
|
|
+ TT.setConstant((int)(F.rows()),F.cols(),-1);
|
|
|
+
|
|
|
+ for(int i=1;i<(int)TTT.size();++i)
|
|
|
+ {
|
|
|
+ std::vector<int>& r1 = TTT[i-1];
|
|
|
+ std::vector<int>& r2 = TTT[i];
|
|
|
+ if ((r1[0] == r2[0]) && (r1[1] == r2[1]))
|
|
|
+ {
|
|
|
+ TT(r1[2],r1[3]) = r2[2];
|
|
|
+ TT(r2[2],r2[3]) = r1[2];
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-template <typename Index>
|
|
|
+template <typename DerivedF, typename TTT_type>
|
|
|
IGL_INLINE void igl::triangle_triangle_adjacency_preprocess(
|
|
|
- const Eigen::PlainObjectBase<Index>& F,
|
|
|
- std::vector<std::vector<int> >& TTT)
|
|
|
+ const Eigen::PlainObjectBase<DerivedF>& F,
|
|
|
+ std::vector<std::vector<TTT_type> >& TTT)
|
|
|
{
|
|
|
for(int f=0;f<F.rows();++f)
|
|
|
for (int i=0;i<F.cols();++i)
|
|
@@ -42,32 +54,11 @@ IGL_INLINE void igl::triangle_triangle_adjacency_preprocess(
|
|
|
std::sort(TTT.begin(),TTT.end());
|
|
|
}
|
|
|
|
|
|
-// Extract the face adjacencies
|
|
|
-template <typename DerivedF, typename DerivedTT>
|
|
|
-IGL_INLINE void igl::triangle_triangle_adjacency_extractTT(
|
|
|
- const Eigen::PlainObjectBase<DerivedF>& F,
|
|
|
- std::vector<std::vector<int> >& TTT,
|
|
|
- Eigen::PlainObjectBase<DerivedTT>& TT)
|
|
|
-{
|
|
|
- TT.setConstant((int)(F.rows()),F.cols(),-1);
|
|
|
-
|
|
|
- for(int i=1;i<(int)TTT.size();++i)
|
|
|
- {
|
|
|
- std::vector<int>& r1 = TTT[i-1];
|
|
|
- std::vector<int>& r2 = TTT[i];
|
|
|
- if ((r1[0] == r2[0]) && (r1[1] == r2[1]))
|
|
|
- {
|
|
|
- TT(r1[2],r1[3]) = r2[2];
|
|
|
- TT(r2[2],r2[3]) = r1[2];
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
// Extract the face adjacencies indices (needed for fast traversal)
|
|
|
-template <typename DerivedF, typename DerivedTTi>
|
|
|
+template <typename DerivedF, typename TTT_type, typename DerivedTTi>
|
|
|
IGL_INLINE void igl::triangle_triangle_adjacency_extractTTi(
|
|
|
const Eigen::PlainObjectBase<DerivedF>& F,
|
|
|
- std::vector<std::vector<int> >& TTT,
|
|
|
+ std::vector<std::vector<TTT_type> >& TTT,
|
|
|
Eigen::PlainObjectBase<DerivedTTi>& TTi)
|
|
|
{
|
|
|
TTi.setConstant((int)(F.rows()),F.cols(),-1);
|
|
@@ -84,34 +75,6 @@ IGL_INLINE void igl::triangle_triangle_adjacency_extractTTi(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// Compute triangle-triangle adjacency
|
|
|
-template <typename Scalar, typename Index>
|
|
|
-IGL_INLINE void igl::triangle_triangle_adjacency(const Eigen::PlainObjectBase<Scalar>& V,
|
|
|
- const Eigen::PlainObjectBase<Index>& F,
|
|
|
- Eigen::PlainObjectBase<Index>& TT)
|
|
|
-{
|
|
|
- //assert(igl::is_edge_manifold(V,F));
|
|
|
- std::vector<std::vector<int> > TTT;
|
|
|
-
|
|
|
- triangle_triangle_adjacency_preprocess(V,F,TTT);
|
|
|
- triangle_triangle_adjacency_extractTT(F,TTT,TT);
|
|
|
-}
|
|
|
-
|
|
|
-// Compute triangle-triangle adjacency with indices
|
|
|
-template <typename Scalar, typename Index>
|
|
|
-IGL_INLINE void igl::triangle_triangle_adjacency(
|
|
|
- const Eigen::PlainObjectBase<Scalar>& /*V*/,
|
|
|
- const Eigen::PlainObjectBase<Index>& F,
|
|
|
- Eigen::PlainObjectBase<Index>& TT,
|
|
|
- Eigen::PlainObjectBase<Index>& TTi)
|
|
|
-{
|
|
|
- //assert(igl::is_edge_manifold(V,F));
|
|
|
- std::vector<std::vector<int> > TTT;
|
|
|
- triangle_triangle_adjacency_preprocess(F,TTT);
|
|
|
- triangle_triangle_adjacency_extractTT(F,TTT,TT);
|
|
|
- triangle_triangle_adjacency_extractTTi(F,TTT,TTi);
|
|
|
-}
|
|
|
-
|
|
|
// Compute triangle-triangle adjacency with indices
|
|
|
template <typename DerivedF, typename DerivedTT, typename DerivedTTi>
|
|
|
IGL_INLINE void igl::triangle_triangle_adjacency(
|
|
@@ -119,7 +82,6 @@ IGL_INLINE void igl::triangle_triangle_adjacency(
|
|
|
Eigen::PlainObjectBase<DerivedTT>& TT,
|
|
|
Eigen::PlainObjectBase<DerivedTTi>& TTi)
|
|
|
{
|
|
|
- //assert(igl::is_edge_manifold(V,F));
|
|
|
std::vector<std::vector<int> > TTT;
|
|
|
triangle_triangle_adjacency_preprocess(F,TTT);
|
|
|
triangle_triangle_adjacency_extractTT(F,TTT,TT);
|
|
@@ -235,10 +197,6 @@ template <
|
|
|
|
|
|
#ifdef IGL_STATIC_LIBRARY
|
|
|
// Explicit template specialization
|
|
|
-template void igl::triangle_triangle_adjacency<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&);
|
|
|
-template void igl::triangle_triangle_adjacency<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&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
|
|
|
-template void igl::triangle_triangle_adjacency<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&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
|
|
|
-template void igl::triangle_triangle_adjacency<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&);
|
|
|
template void igl::triangle_triangle_adjacency<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
|
|
|
template void igl::triangle_triangle_adjacency<Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, long, long, long>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> > const&, std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > > const&, bool, std::vector<std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >, std::allocator<std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > > > >&, std::vector<std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >, std::allocator<std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > > > >&);
|
|
|
template void igl::triangle_triangle_adjacency<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, unsigned long, int, int>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > > const&, bool, std::vector<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >, std::allocator<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > > >&, std::vector<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >, std::allocator<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > > >&);
|