// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2019 Alec Jacobson // // 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 "iterative_closest_point.h" #include "AABB.h" #include "per_face_normals.h" #include "random_points_on_mesh.h" #include "rigid_alignment.h" #include #include template < typename DerivedVX, typename DerivedFX, typename DerivedVY, typename DerivedFY, typename DerivedR, typename Derivedt > IGL_INLINE void igl::iterative_closest_point( const Eigen::MatrixBase & VX, const Eigen::MatrixBase & FX, const Eigen::MatrixBase & VY, const Eigen::MatrixBase & FY, const int num_samples, const int max_iters, Eigen::PlainObjectBase & R, Eigen::PlainObjectBase & t) { assert(VX.cols() == 3 && "X should be a mesh in 3D"); assert(VY.cols() == 3 && "Y should be a mesh in 3D"); typedef typename DerivedVX::Scalar Scalar; typedef Eigen::Matrix MatrixXS; // Precompute BVH on Y AABB Ytree; Ytree.init(VY,FY); MatrixXS NY; per_face_normals(VY,FY,NY); return iterative_closest_point( VX,FX,VY,FY,Ytree,NY,num_samples,max_iters,R,t); } template < typename DerivedVX, typename DerivedFX, typename DerivedVY, typename DerivedFY, typename DerivedNY, typename DerivedR, typename Derivedt > IGL_INLINE void igl::iterative_closest_point( const Eigen::MatrixBase & VX, const Eigen::MatrixBase & FX, const Eigen::MatrixBase & VY, const Eigen::MatrixBase & FY, const igl::AABB & Ytree, const Eigen::MatrixBase & NY, const int num_samples, const int max_iters, Eigen::PlainObjectBase & R, Eigen::PlainObjectBase & t) { typedef typename DerivedVX::Scalar Scalar; typedef Eigen::Matrix MatrixXS; typedef Eigen::Matrix VectorXS; typedef Eigen::Matrix Matrix3S; typedef Eigen::Matrix MatrixX3S; typedef Eigen::Matrix RowVector3S; R.setIdentity(3,3); t.setConstant(1,3,0); for(int iter = 0;iter, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, int, int, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); #endif