|
@@ -3,8 +3,10 @@
|
|
|
#include "is_manifold.h"
|
|
|
#include <algorithm>
|
|
|
|
|
|
-template<typename T, typename S>
|
|
|
-IGL_INLINE void igl::tt_preprocess(const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& , const Eigen::Matrix<S,Eigen::Dynamic, Eigen::Dynamic>& F, std::vector<std::vector<int> >& TTT)
|
|
|
+template <typename DerivedV, typename DerivedF>
|
|
|
+IGL_INLINE void igl::tt_preprocess(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)
|
|
@@ -22,10 +24,12 @@ IGL_INLINE void igl::tt_preprocess(const Eigen::Matrix<T, Eigen::Dynamic, Eigen:
|
|
|
}
|
|
|
|
|
|
// Extract the face adjacencies
|
|
|
-template<typename S>
|
|
|
-IGL_INLINE void igl::tt_extractTT(const Eigen::Matrix<S,Eigen::Dynamic, Eigen::Dynamic>& F, std::vector<std::vector<int> >& TTT, Eigen::Matrix<S,Eigen::Dynamic, Eigen::Dynamic>& TT)
|
|
|
+template <typename DerivedF, typename DerivedTT>
|
|
|
+IGL_INLINE void igl::tt_extractTT(const Eigen::PlainObjectBase<DerivedF>& F,
|
|
|
+ std::vector<std::vector<int> >& TTT,
|
|
|
+ Eigen::PlainObjectBase<DerivedTT>& TT)
|
|
|
{
|
|
|
- TT = Eigen::Matrix<S,Eigen::Dynamic, Eigen::Dynamic>::Constant((int)(F.rows()),3,-1);
|
|
|
+ TT = Eigen::PlainObjectBase<DerivedTT>::Constant((int)(F.rows()),3,-1);
|
|
|
|
|
|
for(int i=1;i<(int)TTT.size();++i)
|
|
|
{
|
|
@@ -40,10 +44,12 @@ IGL_INLINE void igl::tt_extractTT(const Eigen::Matrix<S,Eigen::Dynamic, Eigen::D
|
|
|
}
|
|
|
|
|
|
// Extract the face adjacencies indices (needed for fast traversal)
|
|
|
-template<typename S>
|
|
|
-IGL_INLINE void igl::tt_extractTTi(const Eigen::Matrix<S,Eigen::Dynamic, Eigen::Dynamic>& F, std::vector<std::vector<int> >& TTT, Eigen::Matrix<S,Eigen::Dynamic, Eigen::Dynamic>& TTi)
|
|
|
+template <typename DerivedF, typename DerivedTT>
|
|
|
+IGL_INLINE void igl::tt_extractTTi(const Eigen::PlainObjectBase<DerivedF>& F,
|
|
|
+ std::vector<std::vector<int> >& TTT,
|
|
|
+ Eigen::PlainObjectBase<DerivedTT>& TTi)
|
|
|
{
|
|
|
- TTi = Eigen::Matrix<S,Eigen::Dynamic, Eigen::Dynamic>::Constant((int)(F.rows()),3,-1);
|
|
|
+ TTi = Eigen::PlainObjectBase<DerivedTT>::Constant((int)(F.rows()),3,-1);
|
|
|
|
|
|
for(int i=1;i<(int)TTT.size();++i)
|
|
|
{
|
|
@@ -58,24 +64,29 @@ IGL_INLINE void igl::tt_extractTTi(const Eigen::Matrix<S,Eigen::Dynamic, Eigen::
|
|
|
}
|
|
|
|
|
|
// Compute triangle-triangle adjacency
|
|
|
-template<typename T, typename S>
|
|
|
-IGL_INLINE void igl::tt(const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& V, const Eigen::Matrix<S,Eigen::Dynamic, Eigen::Dynamic>& F, Eigen::Matrix<S,Eigen::Dynamic, Eigen::Dynamic>& TT)
|
|
|
+template <typename DerivedV, typename DerivedF, typename DerivedTT>
|
|
|
+IGL_INLINE void igl::tt(const Eigen::PlainObjectBase<DerivedV>& V,
|
|
|
+ const Eigen::PlainObjectBase<DerivedF>& F,
|
|
|
+ Eigen::PlainObjectBase<DerivedTT>& TT)
|
|
|
{
|
|
|
assert(igl::is_manifold(V,F));
|
|
|
std::vector<std::vector<int> > TTT;
|
|
|
|
|
|
- tt_preprocess<T>(V,F,TTT);
|
|
|
+ tt_preprocess(V,F,TTT);
|
|
|
tt_extractTT(F,TTT,TT);
|
|
|
}
|
|
|
|
|
|
// Compute triangle-triangle adjacency with indices
|
|
|
-template<typename T, typename S>
|
|
|
-IGL_INLINE void igl::tt(const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& V, const Eigen::Matrix<S,Eigen::Dynamic, Eigen::Dynamic>& F, Eigen::Matrix<S,Eigen::Dynamic, Eigen::Dynamic>& TT, Eigen::Matrix<S,Eigen::Dynamic, Eigen::Dynamic>& TTi)
|
|
|
+template <typename DerivedV, typename DerivedF, typename DerivedTT>
|
|
|
+IGL_INLINE void igl::tt(const Eigen::PlainObjectBase<DerivedV>& V,
|
|
|
+ const Eigen::PlainObjectBase<DerivedF>& F,
|
|
|
+ Eigen::PlainObjectBase<DerivedTT>& TT,
|
|
|
+ Eigen::PlainObjectBase<DerivedTT>& TTi)
|
|
|
{
|
|
|
assert(igl::is_manifold(V,F));
|
|
|
std::vector<std::vector<int> > TTT;
|
|
|
|
|
|
- tt_preprocess<T>(V,F,TTT);
|
|
|
+ tt_preprocess(V,F,TTT);
|
|
|
tt_extractTT(F,TTT,TT);
|
|
|
tt_extractTTi(F,TTT,TTi);
|
|
|
}
|
|
@@ -83,6 +94,5 @@ IGL_INLINE void igl::tt(const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>&
|
|
|
#ifndef IGL_HEADER_ONLY
|
|
|
// Explicit template specialization
|
|
|
// generated by autoexplicit.sh
|
|
|
-template void igl::tt<double>(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, -1, 0, -1, -1>&);
|
|
|
-template void igl::tt<double, int>(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, -1, 0, -1, -1>&, Eigen::Matrix<int, -1, -1, 0, -1, -1>&);
|
|
|
+template void igl::tt<Eigen::Matrix<double, -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<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> >&);
|
|
|
#endif
|