fit_plane.h 999 B

123456789101112131415161718192021222324252627282930313233
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Daniele Panozzo <[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_FIT_PLANE_H
  9. #define IGL_FIT_PLANE_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Dense>
  12. namespace igl
  13. {
  14. /// Fit a plane to a point cloud.
  15. ///
  16. /// @param[in] V #Vx3 matrix. The 3D point cloud, one row for each vertex.
  17. /// @param[out] N 1x3 Vector. The normal of the fitted plane.
  18. /// @param[out] C 1x3 Vector. A point that lies in the fitted plane.
  19. ///
  20. /// From http://missingbytes.blogspot.com/2012/06/fitting-plane-to-point-cloud.html
  21. IGL_INLINE void fit_plane(
  22. const Eigen::MatrixXd & V,
  23. Eigen::RowVector3d & N,
  24. Eigen::RowVector3d & C);
  25. }
  26. #ifndef IGL_STATIC_LIBRARY
  27. # include "fit_plane.cpp"
  28. #endif
  29. #endif