bounding_box_diagonal.cpp 766 B

1234567891011121314151617181920212223242526
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 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 "bounding_box_diagonal.h"
  9. #include "mat_max.h"
  10. #include "mat_min.h"
  11. #include <cmath>
  12. IGL_INLINE double igl::bounding_box_diagonal(
  13. const Eigen::MatrixXd & V)
  14. {
  15. using namespace Eigen;
  16. VectorXd maxV,minV;
  17. VectorXi maxVI,minVI;
  18. mat_max(V,1,maxV,maxVI);
  19. mat_min(V,1,minV,minVI);
  20. return sqrt((maxV-minV).array().square().sum());
  21. }
  22. #ifdef IGL_STATIC_LIBRARY
  23. // Explicit template specialization
  24. #endif