lipschitz_octree.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2025 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_LIPSCHITZ_OCTREE_H
  9. #define IGL_LIPSCHITZ_OCTREE_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. /// Given a minimum corner position (origin) and a side length (h0) and a
  15. /// maximum depth (max_depth), determine the possible active leaf octree cells
  16. /// based on an one-Lipschitz non-negative function to a level set (e.g.,
  17. /// "unsigned distance function").
  18. ///
  19. /// @param[in] origin 3-vector of root cell origin (minimum corner)
  20. /// @param[in] h0 side length of root cell
  21. /// @param[in] max_depth maximum depth of octree (root is depth=0)
  22. /// @param[in] udf 1-Lipschitz function of (unsigned) distance to level set
  23. /// @param[out] ijk #ijk by 3 list of octree leaf cell minimum corner
  24. /// subscripts
  25. template <
  26. bool batched=false,
  27. typename Derivedorigin,
  28. typename Func,
  29. typename Derivedijk
  30. >
  31. IGL_INLINE void lipschitz_octree(
  32. const Eigen::MatrixBase<Derivedorigin> & origin,
  33. const typename Derivedorigin::Scalar h0,
  34. const int max_depth,
  35. const Func & udf,
  36. Eigen::PlainObjectBase<Derivedijk> & ijk);
  37. }
  38. #ifndef IGL_STATIC_LIBRARY
  39. # include "lipschitz_octree.cpp"
  40. #endif
  41. #endif