point_areas.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2018 Gavin Barill <[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_POINT_AREAS_H
  9. #define IGL_COPYLEFT_CGAL_POINT_AREAS_H
  10. #include "../../igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. namespace copyleft
  15. {
  16. namespace cgal
  17. {
  18. /// Given a 3D set of points P, each with a list of k-nearest-neighbours,
  19. /// estimate the geodesic voronoi area associated with each point.
  20. ///
  21. /// The k nearest neighbours may be known from running igl::knn_octree on
  22. /// the output data from igl::octree. We reccomend using a k value
  23. /// between 15 and 20 inclusive for accurate area estimation.
  24. ///
  25. /// N is used filter the neighbours, to ensure area estimation only occurs
  26. /// using neighbors that are on the same side of the surface (ie for thin
  27. /// sheets), as well as to solve the orientation ambiguity of the tangent
  28. /// plane normal.
  29. ///
  30. /// \note This function *should* be implemented by pre-filtering I, rather
  31. /// than filtering in this function using N. In this case, the function
  32. /// would only take P and I as input.
  33. ///
  34. /// @param[in] P #P by 3 list of point locations
  35. /// @param[in] I #P by k list of k-nearest-neighbor indices into P
  36. /// @param[in] N #P by 3 list of point normals
  37. /// @param[out] A #P list of estimated areas
  38. // @param[out] T #P by 3 list of tangent plane normals for each point
  39. ///
  40. /// \see igl::knn
  41. template <typename DerivedP, typename DerivedI, typename DerivedN,
  42. typename DerivedA, typename DerivedT>
  43. IGL_INLINE void point_areas(
  44. const Eigen::MatrixBase<DerivedP>& P,
  45. const Eigen::MatrixBase<DerivedI>& I,
  46. const Eigen::MatrixBase<DerivedN>& N,
  47. Eigen::PlainObjectBase<DerivedA> & A,
  48. Eigen::PlainObjectBase<DerivedT> & T);
  49. /// \overload
  50. template <typename DerivedP, typename DerivedI, typename DerivedN,
  51. typename DerivedA>
  52. IGL_INLINE void point_areas(
  53. const Eigen::MatrixBase<DerivedP>& P,
  54. const Eigen::MatrixBase<DerivedI>& I,
  55. const Eigen::MatrixBase<DerivedN>& N,
  56. Eigen::PlainObjectBase<DerivedA> & A);
  57. }
  58. }
  59. }
  60. #ifndef IGL_STATIC_LIBRARY
  61. # include "point_areas.cpp"
  62. #endif
  63. #endif