bounding_box_diagonal.cpp 748 B

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