quad_grid.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2019 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_QUAD_GRID_H
  9. #define IGL_QUAD_GRID_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. // Generate a quad mesh over a regular grid.
  15. //
  16. // @param[in] nx number of vertices in the x direction
  17. // @param[in] ny number of vertices in the y direction
  18. // @param[out] V nx*ny by 2 list of vertex positions
  19. // @param[out] Q (nx-1)*(ny-1) by 4 list of quad indices into V
  20. // @param[out] E (nx-1)*ny+(ny-1)*nx by 2 list of undirected quad edge indices into V
  21. //
  22. // \see grid, triangulated_grid
  23. template<
  24. typename DerivedV,
  25. typename DerivedQ,
  26. typename DerivedE>
  27. IGL_INLINE void quad_grid(
  28. const int nx,
  29. const int ny,
  30. Eigen::PlainObjectBase<DerivedV> & V,
  31. Eigen::PlainObjectBase<DerivedQ> & Q,
  32. Eigen::PlainObjectBase<DerivedE> & E);
  33. /// \overload
  34. template<
  35. typename DerivedQ,
  36. typename DerivedE>
  37. IGL_INLINE void quad_grid(
  38. const int nx,
  39. const int ny,
  40. Eigen::PlainObjectBase<DerivedQ> & Q,
  41. Eigen::PlainObjectBase<DerivedE> & E);
  42. }
  43. #ifndef IGL_STATIC_LIBRARY
  44. # include "quad_grid.cpp"
  45. #endif
  46. #endif