#ifndef ANDROID_DVR_ORTHO_H_ #define ANDROID_DVR_ORTHO_H_ #include namespace android { namespace dvr { template Eigen::AffineMatrix OrthoMatrix(T left, T right, T bottom, T top, T znear, T zfar) { Eigen::AffineMatrix result; const T t2 = static_cast(2); const T a = t2 / (right - left); const T b = t2 / (top - bottom); const T c = t2 / (zfar - znear); const T xoff = -(right + left) / (right - left); const T yoff = -(top + bottom) / (top - bottom); const T zoff = -(zfar + znear) / (zfar - znear); const T t1 = static_cast(1); result.matrix() << a, 0, 0, xoff, 0, b, 0, yoff, 0, 0, c, zoff, 0, 0, 0, t1; return result; } } // namespace android } // namespace dvr #endif // ANDROID_DVR_ORTHO_H_