snap_rounding.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 Alec Jacobson <alecjacobson@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_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_ROUNDING Snap a list of possible intersecting segments with
  19. // endpoints in any precision to _the_ integer grid.
  20. //
  21. // Inputs:
  22. // V #V by 2 list of vertex positions
  23. // E #E by 2 list of segment indices into V
  24. // Outputs:
  25. // VI #VI by 2 list of output integer vertex positions, rounded copies
  26. // of V are always the first #V vertices
  27. // EI #EI by 2 list of segment indices into V, #EI ≥ #E
  28. // J #EI list of indices into E revealing "parent segments"
  29. template <
  30. typename DerivedV,
  31. typename DerivedE,
  32. typename DerivedVI,
  33. typename DerivedEI,
  34. typename DerivedJ>
  35. IGL_INLINE void snap_rounding(
  36. const Eigen::PlainObjectBase<DerivedV> & V,
  37. const Eigen::PlainObjectBase<DerivedE> & E,
  38. Eigen::PlainObjectBase<DerivedVI> & VI,
  39. Eigen::PlainObjectBase<DerivedEI> & EI,
  40. Eigen::PlainObjectBase<DerivedJ> & J);
  41. }
  42. }
  43. }
  44. #ifndef IGL_STATIC_LIBRARY
  45. # include "snap_rounding.cpp"
  46. #endif
  47. #endif