1 // This file is part of libigl, a simple c++ geometry processing library.
2 //
3 // Copyright (C) 2014 Daniele Panozzo <daniele.panozzo@gmail.com>, Olga Diamanti <olga.diam@gmail.com>
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public License
6 // v. 2.0. If a copy of the MPL was not distributed with this file, You can
7 // obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #ifndef IGL_CROSS_FIELD_MISSMATCH_H
10 #define IGL_CROSS_FIELD_MISSMATCH_H
11 #include "igl_inline.h"
12 #include <Eigen/Core>
13 namespace igl
14 {
15   // Calculates the missmatch (integer), at each face edge, of a cross field defined on the mesh faces.
16   // The integer missmatch is a multiple of pi/2 that transforms the cross on one side of the edge to
17   // the cross on the other side. It represents the deviation from a Lie connection across the edge.
18 
19   // Inputs:
20   //   V         #V by 3 eigen Matrix of mesh vertex 3D positions
21   //   F         #F by 3 eigen Matrix of face (quad) indices
22   //   PD1       #F by 3 eigen Matrix of the first per face cross field vector
23   //   PD2       #F by 3 eigen Matrix of the second per face cross field vector
24   //   isCombed  boolean, specifying whether the field is combed (i.e. matching has been precomputed.
25   //             If not, the field is combed first.
26   // Output:
27   //   Handle_MMatch    #F by 3 eigen Matrix containing the integer missmatch of the cross field
28   //                    across all face edges
29   //
30 
31   template <typename DerivedV, typename DerivedF, typename DerivedM>
32   IGL_INLINE void cross_field_missmatch(const Eigen::PlainObjectBase<DerivedV> &V,
33                                         const Eigen::PlainObjectBase<DerivedF> &F,
34                                         const Eigen::PlainObjectBase<DerivedV> &PD1,
35                                         const Eigen::PlainObjectBase<DerivedV> &PD2,
36                                         const bool isCombed,
37                                         Eigen::PlainObjectBase<DerivedM> &missmatch);
38 }
39 #ifndef IGL_STATIC_LIBRARY
40 #include "cross_field_missmatch.cpp"
41 #endif
42 
43 #endif
44