ortho.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 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 "ortho.h"
  9. template < typename DerivedP>
  10. IGL_INLINE void igl::ortho(
  11. const typename DerivedP::Scalar left,
  12. const typename DerivedP::Scalar right,
  13. const typename DerivedP::Scalar bottom,
  14. const typename DerivedP::Scalar top,
  15. const typename DerivedP::Scalar nearVal,
  16. const typename DerivedP::Scalar farVal,
  17. Eigen::PlainObjectBase<DerivedP> & P)
  18. {
  19. P.setIdentity();
  20. P(0,0) = 2. / (right - left);
  21. P(1,1) = 2. / (top - bottom);
  22. P(2,2) = - 2./ (farVal - nearVal);
  23. P(0,3) = - (right + left) / (right - left);
  24. P(1,3) = - (top + bottom) / (top - bottom);
  25. P(2,3) = - (farVal + nearVal) / (farVal - nearVal);
  26. }
  27. #ifdef IGL_STATIC_LIBRARY
  28. // Explicit template specialization
  29. // generated by autoexplicit.sh
  30. template void igl::ortho<Eigen::Matrix<float, 4, 4, 0, 4, 4> >(Eigen::Matrix<float, 4, 4, 0, 4, 4>::Scalar, Eigen::Matrix<float, 4, 4, 0, 4, 4>::Scalar, Eigen::Matrix<float, 4, 4, 0, 4, 4>::Scalar, Eigen::Matrix<float, 4, 4, 0, 4, 4>::Scalar, Eigen::Matrix<float, 4, 4, 0, 4, 4>::Scalar, Eigen::Matrix<float, 4, 4, 0, 4, 4>::Scalar, Eigen::PlainObjectBase<Eigen::Matrix<float, 4, 4, 0, 4, 4> >&);
  31. #endif