fit_plane.h 1000 B

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