field_local_global_conversions.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 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. #ifndef IGL_FIELD_LOCAL_GLOBAL_CONVERSIONS
  9. #define IGL_FIELD_LOCAL_GLOBAL_CONVERSIONS
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <vector>
  13. namespace igl {
  14. // Converts a face-based polyvector field consisting of n vectors per face
  15. // from its 3D coordinates to its local 2D representation (with respect to the
  16. // local bases of each triangle)
  17. // Inputs:
  18. // B1 #F by 3 list of the first basis vector of each triangle
  19. // B2 #F by 3 list of the second basis vector of each triangle
  20. // global #F by 3n list of the 3D coordinates of the per-face vectors
  21. // (stacked horizontally for each triangle)
  22. // Output:
  23. // local #F by 2n list of the 2D representation of the per-face vectors
  24. // (stacked horizontally for each triangle)
  25. //
  26. template <typename DerivedG, typename DerivedL, typename DerivedB>
  27. IGL_INLINE void global2local(
  28. const Eigen::PlainObjectBase<DerivedB>& B1,
  29. const Eigen::PlainObjectBase<DerivedB>& B2,
  30. const Eigen::PlainObjectBase<DerivedG>& global,
  31. Eigen::PlainObjectBase<DerivedL>& local);
  32. // Converts a face-based polyvector field consisting of n vectors per face
  33. // from its local 2D representation (with respect to the local bases of each
  34. // triangle) to its 3D coordinates
  35. // Inputs:
  36. // B1 #F by 3 list of the first basis vector of each triangle
  37. // B2 #F by 3 list of the second basis vector of each triangle
  38. // local #F by 2n list of the 2D representation of the per-face vectors
  39. // (stacked horizontally for each triangle)
  40. // Output:
  41. // global #F by 3n list of the 3D coordinates of the per-face vectors
  42. // (stacked horizontally for each triangle)
  43. //
  44. template <typename DerivedG, typename DerivedL, typename DerivedB>
  45. IGL_INLINE void local2global(
  46. const Eigen::PlainObjectBase<DerivedB>& B1,
  47. const Eigen::PlainObjectBase<DerivedB>& B2,
  48. const Eigen::PlainObjectBase<DerivedL>& local,
  49. Eigen::PlainObjectBase<DerivedG>& global);
  50. };
  51. #ifndef IGL_STATIC_LIBRARY
  52. #include "field_local_global_conversions.cpp"
  53. #endif
  54. #endif /* defined(IGL_FIELD_LOCAL_GLOBAL_CONVERSIONS) */