point_areas_and_normals.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2018 Gavin Barill <gavinpcb@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_POINT_AREAS_AND_NORMALS_H
  9. #define IGL_POINT_AREAS_AND_NORMALS_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::build_octree. We reccomend using a k value
  23. // between 15 and 20 inclusive for accurate area estimation.
  24. //
  25. // If given, O represents an input oritentaiton to each point. This could
  26. // be an initial guess at the normals, a vector to a camera position (for
  27. // scanned data), or ground truth normals if you're only interested in the
  28. // area estimation. It's used to ensure area estimation only occurs using
  29. // neighbors that are on the same side of the surface (ie for thin
  30. // sheets), as well as to solve the orientation ambiguity of normal
  31. // estimation.
  32. //
  33. // Inputs:
  34. // P #P by 3 list of point locations
  35. // I #P by k list of k-nearest-neighbor indices into P
  36. // O #P by 3 list of point orientation vectors (optional)
  37. // Outputs:
  38. // A #P list of estimated areas
  39. // N #P by 3 list of estimated normals
  40. template <typename DerivedP, typename DerivedI, typename DerivedO,
  41. typename DerivedA, typename DerivedN>
  42. IGL_INLINE void point_areas_and_normals(
  43. const Eigen::MatrixBase<DerivedP>& P,
  44. const Eigen::MatrixBase<DerivedI>& I,
  45. const Eigen::MatrixBase<DerivedO>& O,
  46. Eigen::PlainObjectBase<DerivedA> & A,
  47. Eigen::PlainObjectBase<DerivedN> & N);
  48. }
  49. }
  50. }
  51. #ifndef IGL_STATIC_LIBRARY
  52. # include "point_areas_and_normals.cpp"
  53. #endif
  54. #endif