ortho.cpp 635 B

1234567891011121314151617181920
  1. #include "ortho.h"
  2. template < typename DerivedP>
  3. IGL_INLINE void igl::ortho(
  4. const typename DerivedP::Scalar left,
  5. const typename DerivedP::Scalar right,
  6. const typename DerivedP::Scalar bottom,
  7. const typename DerivedP::Scalar top,
  8. const typename DerivedP::Scalar nearVal,
  9. const typename DerivedP::Scalar farVal,
  10. Eigen::PlainObjectBase<DerivedP> & P)
  11. {
  12. P.setIdentity();
  13. P(0,0) = 2. / (right - left);
  14. P(1,1) = 2. / (top - bottom);
  15. P(2,2) = - 2./ (farVal - nearVal);
  16. P(0,3) = - (right + left) / (right - left);
  17. P(1,3) = - (top + bottom) / (top - bottom);
  18. P(2,3) = - (farVal + nearVal) / (farVal - nearVal);
  19. }