shortest_edge_and_midpoint.cpp 781 B

1234567891011121314151617181920212223
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 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 "shortest_edge_and_midpoint.h"
  9. IGL_INLINE void igl::shortest_edge_and_midpoint(
  10. const int e,
  11. const Eigen::MatrixXd & V,
  12. const Eigen::MatrixXi & /*F*/,
  13. const Eigen::MatrixXi & E,
  14. const Eigen::VectorXi & /*EMAP*/,
  15. const Eigen::MatrixXi & /*EF*/,
  16. const Eigen::MatrixXi & /*EI*/,
  17. double & cost,
  18. Eigen::RowVectorXd & p)
  19. {
  20. cost = (V.row(E(e,0))-V.row(E(e,1))).norm();
  21. p = 0.5*(V.row(E(e,0))+V.row(E(e,1)));
  22. }