From ea3d61da15fea500f1c51ab83b477d657ba9b5ca Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Sun, 29 Dec 2013 14:31:46 +0100 Subject: [PATCH] added missing PerspectiveCamera::getDiagonalFov() function --- src/librender/sensor.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/librender/sensor.cpp b/src/librender/sensor.cpp index 7f597554..dccddc33 100644 --- a/src/librender/sensor.cpp +++ b/src/librender/sensor.cpp @@ -312,6 +312,12 @@ Float PerspectiveCamera::getYFov() const { std::tan(0.5f * degToRad(m_xfov)) / m_aspect)); } +Float PerspectiveCamera::getDiagonalFov() const { + Float width = std::tan(0.5f * degToRad(m_xfov)); + Float diagonal = width * std::sqrt(1.0f + 1.0f / (m_aspect*m_aspect)); + return radToDeg(2*std::atan(diagonal)); +} + MTS_IMPLEMENT_CLASS(PerspectiveCamera, true, ProjectiveCamera) MTS_IMPLEMENT_CLASS(ProjectiveCamera, true, Sensor) MTS_IMPLEMENT_CLASS(Sensor, true, AbstractEmitter)