Merge branch 'function_rename' of https://github.com/fwilliams/libigl into fwilliams-function_rename

Former-commit-id: 62b9246c73
This commit is contained in:
hanxiao
2018-10-14 14:07:27 -04:00
7 changed files with 41 additions and 27 deletions
+7
View File
@@ -14,6 +14,8 @@ namespace igl
{
// Compute connected components of facets based on edge-edge adjacency.
//
// For connected components on vertices see igl::vertex_components
//
// Inputs:
// F #F by 3 list of triangle indices
// Outputs:
@@ -22,6 +24,11 @@ namespace igl
IGL_INLINE void facet_components(
const Eigen::PlainObjectBase<DerivedF> & F,
Eigen::PlainObjectBase<DerivedC> & C);
// Compute connected components of facets based on edge-edge adjacency.
//
// For connected components on vertices see igl::vertex_components
//
// Inputs:
// TT #TT by 3 list of list of adjacency triangles (see
// triangle_triangle_adjacency.h)
+3 -3
View File
@@ -6,7 +6,7 @@
// 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 "orientable_patches.h"
#include "components.h"
#include "vertex_components.h"
#include "sort.h"
#include "unique_rows.h"
#include <vector>
@@ -82,10 +82,10 @@ IGL_INLINE void igl::orientable_patches(
}
}
//% Connected components are patches
//%C = components(A); % alternative to graphconncomp from matlab_bgl
//%C = vertex_components(A); % alternative to graphconncomp from matlab_bgl
//[~,C] = graphconncomp(A);
// graph connected components
components(A,C);
vertex_components(A,C);
}
+2 -2
View File
@@ -19,7 +19,7 @@
#include "setxor.h"
#include "edges_to_path.h"
#include "ramer_douglas_peucker.h"
#include "components.h"
#include "vertex_components.h"
#include "list_to_matrix.h"
#include "ears.h"
#include "slice.h"
@@ -199,7 +199,7 @@ IGL_INLINE void igl::straighten_seams(
// Doesn't Compile on older Eigen:
//SparseMatrix<bool> A = OTVT * (!SV).matrix().asDiagonal() * VTOT;
SparseMatrix<bool> A = OTVT * (SV!=true).matrix().asDiagonal() * VTOT;
components(A,C);
vertex_components(A,C);
nc = C.maxCoeff()+1;
}
//std::cout<<"nc: "<<nc<<std::endl;
@@ -5,13 +5,13 @@
// 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 "components.h"
#include "vertex_components.h"
#include "adjacency_matrix.h"
#include <queue>
#include <vector>
template <typename AScalar, typename DerivedC, typename Derivedcounts>
IGL_INLINE void igl::components(
IGL_INLINE void igl::vertex_components(
const Eigen::SparseMatrix<AScalar> & A,
Eigen::PlainObjectBase<DerivedC> & C,
Eigen::PlainObjectBase<Derivedcounts> & counts)
@@ -68,31 +68,31 @@ IGL_INLINE void igl::components(
}
template <typename AScalar, typename DerivedC>
IGL_INLINE void igl::components(
IGL_INLINE void igl::vertex_components(
const Eigen::SparseMatrix<AScalar> & A,
Eigen::PlainObjectBase<DerivedC> & C)
{
Eigen::VectorXi counts;
return components(A,C,counts);
return vertex_components(A,C,counts);
}
template <typename DerivedF, typename DerivedC>
IGL_INLINE void igl::components(
IGL_INLINE void igl::vertex_components(
const Eigen::MatrixBase<DerivedF> & F,
Eigen::PlainObjectBase<DerivedC> & C)
{
Eigen::SparseMatrix<typename DerivedC::Scalar> A;
adjacency_matrix(F,A);
return components(A,C);
return vertex_components(A,C);
}
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
// generated by autoexplicit.sh
template void igl::components<bool, Eigen::Array<int, -1, 1, 0, -1, 1> >(Eigen::SparseMatrix<bool, 0, int> const&, Eigen::PlainObjectBase<Eigen::Array<int, -1, 1, 0, -1, 1> >&);
template void igl::components<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
template void igl::components<int, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::SparseMatrix<int, 0, int> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
template void igl::components<int, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::SparseMatrix<int, 0, int> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
template void igl::components<double, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::SparseMatrix<double, 0, int> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
template void igl::components<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
template void igl::vertex_components<bool, Eigen::Array<int, -1, 1, 0, -1, 1> >(Eigen::SparseMatrix<bool, 0, int> const&, Eigen::PlainObjectBase<Eigen::Array<int, -1, 1, 0, -1, 1> >&);
template void igl::vertex_components<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
template void igl::vertex_components<int, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::SparseMatrix<int, 0, int> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
template void igl::vertex_components<int, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::SparseMatrix<int, 0, int> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
template void igl::vertex_components<double, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::SparseMatrix<double, 0, int> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
template void igl::vertex_components<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
#endif
@@ -13,7 +13,9 @@
namespace igl
{
// Compute connected components of a graph represented by an adjacency
// matrix. This version is faster than the previous version using boost.
// matrix.
//
// Returns a component ID per vertex of the graph where connectivity is established by edges.
//
// Inputs:
// A n by n adjacency matrix
@@ -22,30 +24,35 @@ namespace igl
// counts #components list of counts for each component
//
template <typename AScalar, typename DerivedC, typename Derivedcounts>
IGL_INLINE void components(
IGL_INLINE void vertex_components(
const Eigen::SparseMatrix<AScalar> & A,
Eigen::PlainObjectBase<DerivedC> & C,
Eigen::PlainObjectBase<Derivedcounts> & counts);
template <typename AScalar, typename DerivedC>
IGL_INLINE void components(
IGL_INLINE void vertex_components(
const Eigen::SparseMatrix<AScalar> & A,
Eigen::PlainObjectBase<DerivedC> & C);
// Ditto but for mesh faces as input. This computes connected components of
// **vertices** where **edges** establish connectivity.
// Compute the connected components for a mesh given its faces.
// Returns a component ID per vertex of the mesh where connectivity is established by edges.
//
// For computing connected components per face see igl::facet_components
//
//
// Inputs:
// F n by 3 list of triangle indices
// Outputs:
// C max(F) list of component ids
template <typename DerivedF, typename DerivedC>
IGL_INLINE void components(
IGL_INLINE void vertex_components(
const Eigen::MatrixBase<DerivedF> & F,
Eigen::PlainObjectBase<DerivedC> & C);
}
#ifndef IGL_STATIC_LIBRARY
# include "components.cpp"
# include "vertex_components.cpp"
#endif
#endif
+2 -2
View File
@@ -2,7 +2,7 @@
#include "igl/slim.h"
#include "igl/components.h"
#include "igl/vertex_components.h"
#include "igl/readOBJ.h"
#include "igl/writeOBJ.h"
#include "igl/Timer.h"
@@ -256,7 +256,7 @@ void check_mesh_for_issues(Eigen::MatrixXd& V, Eigen::MatrixXi& F) {
igl::adjacency_matrix(F,A);
Eigen::MatrixXi C, Ci;
igl::components(A, C, Ci);
igl::vertex_components(A, C, Ci);
int connected_components = Ci.rows();
if (connected_components!=1) {
+1 -1
View File
@@ -4,7 +4,7 @@
#include <igl/cotmatrix.h>
#include <igl/jet.h>
#include <igl/edges.h>
#include <igl/components.h>
#include <igl/vertex_components.h>
#include <igl/remove_unreferenced.h>
#include <igl/opengl/glfw/Viewer.h>