|
@@ -1,24 +1,24 @@
|
|
|
// 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
|
|
|
+//
|
|
|
+// Copyright (C) 2014 Daniele Panozzo <daniele.panozzo@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 "tt.h"
|
|
|
+#include "triangle_triangle_adjacency.h"
|
|
|
|
|
|
-#include "is_manifold.h"
|
|
|
+#include <igl/is_manifold.h>
|
|
|
#include <algorithm>
|
|
|
|
|
|
template <typename Scalar, typename Index>
|
|
|
-IGL_INLINE void igl::tt_preprocess(const Eigen::PlainObjectBase<Scalar>& /*V*/,
|
|
|
+IGL_INLINE void igl::triangle_triangle_adjacency_preprocess(const Eigen::PlainObjectBase<Scalar>& /*V*/,
|
|
|
const Eigen::PlainObjectBase<Index>& F,
|
|
|
std::vector<std::vector<int> >& TTT)
|
|
|
{
|
|
|
for(int f=0;f<F.rows();++f)
|
|
|
for (int i=0;i<F.cols();++i)
|
|
|
{
|
|
|
- // v1 v2 f ei
|
|
|
+ // v1 v2 f ei
|
|
|
int v1 = F(f,i);
|
|
|
int v2 = F(f,(i+1)%F.cols());
|
|
|
if (v1 > v2) std::swap(v1,v2);
|
|
@@ -32,12 +32,12 @@ IGL_INLINE void igl::tt_preprocess(const Eigen::PlainObjectBase<Scalar>& /*V*/,
|
|
|
|
|
|
// Extract the face adjacencies
|
|
|
template <typename Index>
|
|
|
-IGL_INLINE void igl::tt_extractTT(const Eigen::PlainObjectBase<Index>& F,
|
|
|
+IGL_INLINE void igl::triangle_triangle_adjacency_extractTT(const Eigen::PlainObjectBase<Index>& F,
|
|
|
std::vector<std::vector<int> >& TTT,
|
|
|
Eigen::PlainObjectBase<Index>& TT)
|
|
|
{
|
|
|
TT = Eigen::PlainObjectBase<Index>::Constant((int)(F.rows()),F.cols(),-1);
|
|
|
-
|
|
|
+
|
|
|
for(int i=1;i<(int)TTT.size();++i)
|
|
|
{
|
|
|
std::vector<int>& r1 = TTT[i-1];
|
|
@@ -52,12 +52,12 @@ IGL_INLINE void igl::tt_extractTT(const Eigen::PlainObjectBase<Index>& F,
|
|
|
|
|
|
// Extract the face adjacencies indices (needed for fast traversal)
|
|
|
template <typename Index>
|
|
|
-IGL_INLINE void igl::tt_extractTTi(const Eigen::PlainObjectBase<Index>& F,
|
|
|
+IGL_INLINE void igl::triangle_triangle_adjacency_extractTTi(const Eigen::PlainObjectBase<Index>& F,
|
|
|
std::vector<std::vector<int> >& TTT,
|
|
|
Eigen::PlainObjectBase<Index>& TTi)
|
|
|
{
|
|
|
TTi = Eigen::PlainObjectBase<Index>::Constant((int)(F.rows()),F.cols(),-1);
|
|
|
-
|
|
|
+
|
|
|
for(int i=1;i<(int)TTT.size();++i)
|
|
|
{
|
|
|
std::vector<int>& r1 = TTT[i-1];
|
|
@@ -72,36 +72,36 @@ IGL_INLINE void igl::tt_extractTTi(const Eigen::PlainObjectBase<Index>& F,
|
|
|
|
|
|
// Compute triangle-triangle adjacency
|
|
|
template <typename Scalar, typename Index>
|
|
|
-IGL_INLINE void igl::tt(const Eigen::PlainObjectBase<Scalar>& V,
|
|
|
+IGL_INLINE void igl::triangle_triangle_adjacency(const Eigen::PlainObjectBase<Scalar>& V,
|
|
|
const Eigen::PlainObjectBase<Index>& F,
|
|
|
Eigen::PlainObjectBase<Index>& TT)
|
|
|
{
|
|
|
//assert(igl::is_manifold(V,F));
|
|
|
std::vector<std::vector<int> > TTT;
|
|
|
-
|
|
|
- tt_preprocess(V,F,TTT);
|
|
|
- tt_extractTT(F,TTT,TT);
|
|
|
+
|
|
|
+ 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::tt(const Eigen::PlainObjectBase<Scalar>& V,
|
|
|
+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_manifold(V,F));
|
|
|
std::vector<std::vector<int> > TTT;
|
|
|
-
|
|
|
- tt_preprocess(V,F,TTT);
|
|
|
- tt_extractTT(F,TTT,TT);
|
|
|
- tt_extractTTi(F,TTT,TTi);
|
|
|
+
|
|
|
+ triangle_triangle_adjacency_preprocess(V,F,TTT);
|
|
|
+ triangle_triangle_adjacency_extractTT(F,TTT,TT);
|
|
|
+ triangle_triangle_adjacency_extractTTi(F,TTT,TTi);
|
|
|
}
|
|
|
|
|
|
#ifndef IGL_HEADER_ONLY
|
|
|
// Explicit template specialization
|
|
|
-template void igl::tt<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> >&);
|
|
|
// generated by autoexplicit.sh
|
|
|
-template void igl::tt<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::tt<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> >&);
|
|
|
+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> >&);
|
|
|
#endif
|