point_areas_and_normals.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. // Given a 3D set of points P, each with a list of k-nearest-neighbours,
  15. // estimate the geodesic voronoi area associated with each point.
  16. // If given, O represents an input oritentaiton to each point. This could
  17. // be an initial guess at the normals, a vector to a camera position (for
  18. // scanned data), or ground truth normals if you're only interested in the
  19. // area estimation. It's used to ensure area estimation only occurs using
  20. // neighbors that are on the same side of the surface (ie for thin
  21. // sheets), as well as to solve the orientation ambiguity of normal
  22. // estimation.
  23. //
  24. // Inputs:
  25. // P #P by 3 list of point locations
  26. // I #P by k list of k-nearest-neighbor indices into P
  27. // O #P by 3 list of point orientation vectors (optional)
  28. // Outputs:
  29. // A #P list of estimated areas
  30. // N #P by 3 list of estimated normals
  31. template <typename DerivedP, typename DerivedI, typename DerivedO>
  32. IGL_INLINE void point_areas_and_normals(
  33. const Eigen::MatrixBase<DerivedP>& P,
  34. const Eigen::MatrixBase<DerivedI>& I,
  35. const Eigen::MatrixBase<DerivedO>& O,
  36. Eigen::MatrixBase<DerivedA> & A,
  37. Eigen::MatrixBase<DerivedN> & N);
  38. }
  39. #ifndef IGL_STATIC_LIBRARY
  40. # include "point_areas_and_normals.cpp"
  41. #endif
  42. #endif