shape_diameter_function.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 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_EMBREE_SHAPE_DIAMETER_FUNCTION_H
  9. #define IGL_EMBREE_SHAPE_DIAMETER_FUNCTION_H
  10. #include "../igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. namespace embree
  15. {
  16. // Forward define
  17. class EmbreeIntersector;
  18. /// Compute shape diamter function per given point
  19. ///
  20. /// @param[in] ei EmbreeIntersector containing (V,F)
  21. /// @param[in] P #P by 3 list of origin points
  22. /// @param[in] N #P by 3 list of origin normals
  23. /// @param[out] S #P list of shape diamater function values between bounding box
  24. /// diagonal (perfect sphere) and 0 (perfect needle hook)
  25. ///
  26. template <
  27. typename DerivedP,
  28. typename DerivedN,
  29. typename DerivedS >
  30. IGL_INLINE void shape_diameter_function(
  31. const EmbreeIntersector & ei,
  32. const Eigen::MatrixBase<DerivedP> & P,
  33. const Eigen::MatrixBase<DerivedN> & N,
  34. const int num_samples,
  35. Eigen::PlainObjectBase<DerivedS> & S);
  36. /// \overload
  37. /// \brief Wrapper which builds new EmbreeIntersector for (V,F). That's expensive so
  38. /// avoid this if repeatedly calling.
  39. /// @param[in] V #V by 3 list of mesh vertex positiosn
  40. /// @param[in] F #F by 3 list of mesh triangle indices into rows of V
  41. template <
  42. typename DerivedV,
  43. typename DerivedF,
  44. typename DerivedP,
  45. typename DerivedN,
  46. typename DerivedS >
  47. IGL_INLINE void shape_diameter_function(
  48. const Eigen::MatrixBase<DerivedV> & V,
  49. const Eigen::MatrixBase<DerivedF> & F,
  50. const Eigen::MatrixBase<DerivedP> & P,
  51. const Eigen::MatrixBase<DerivedN> & N,
  52. const int num_samples,
  53. Eigen::PlainObjectBase<DerivedS> & S);
  54. }
  55. };
  56. #ifndef IGL_STATIC_LIBRARY
  57. # include "shape_diameter_function.cpp"
  58. #endif
  59. #endif