snap_rounding.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 Alec Jacobson <[email protected]>
  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_COPYLEFT_CGAL_SNAP_ROUNDING_H
  9. #define IGL_COPYLEFT_CGAL_SNAP_ROUNDING_H
  10. #include "../../igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. namespace copyleft
  15. {
  16. namespace cgal
  17. {
  18. /// Snap a list of possible intersecting segments with
  19. /// endpoints in any precision to _the_ integer grid.
  20. ///
  21. /// @param[in] V #V by 2 list of vertex positions
  22. /// @param[in] E #E by 2 list of segment indices into V
  23. /// @param[out] VI #VI by 2 list of output integer vertex positions, rounded copies
  24. /// of V are always the first #V vertices
  25. /// @param[out] EI #EI by 2 list of segment indices into V, #EI ≥ #E
  26. /// @param[out] J #EI list of indices into E revealing "parent segments"
  27. template <
  28. typename DerivedV,
  29. typename DerivedE,
  30. typename DerivedVI,
  31. typename DerivedEI,
  32. typename DerivedJ>
  33. IGL_INLINE void snap_rounding(
  34. const Eigen::MatrixBase<DerivedV> & V,
  35. const Eigen::MatrixBase<DerivedE> & E,
  36. Eigen::PlainObjectBase<DerivedVI> & VI,
  37. Eigen::PlainObjectBase<DerivedEI> & EI,
  38. Eigen::PlainObjectBase<DerivedJ> & J);
  39. }
  40. }
  41. }
  42. #ifndef IGL_STATIC_LIBRARY
  43. # include "snap_rounding.cpp"
  44. #endif
  45. #endif