is_planar.cpp 587 B

123456789101112131415161718
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2014 Alec Jacobson <alecjacobson@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. #include "is_planar.h"
  9. IGL_INLINE bool igl::is_planar(const Eigen::MatrixXd & V)
  10. {
  11. if(V.size() == 0) return false;
  12. if(V.cols() == 2) return true;
  13. for(int i = 0;i<V.rows();i++)
  14. {
  15. if(V(i,2) != 0) return false;
  16. }
  17. return true;
  18. }