From 3064a869cc2594b4f86b51378be34cb160a4f2c1 Mon Sep 17 00:00:00 2001 From: matteodelle Date: Wed, 21 Jul 2010 15:54:31 +0000 Subject: [PATCH] Michele Sottile: added GetFovFromFocal --- vcg/math/shot.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vcg/math/shot.h b/vcg/math/shot.h index 4d6fe39d..57830806 100644 --- a/vcg/math/shot.h +++ b/vcg/math/shot.h @@ -169,6 +169,9 @@ public: /// SET the viewpoint void SetViewPoint(const vcg::Point3 & viewpoint); + /// GET fov from focal + float GetFovFromFocal(); + /// look at (point+up) void LookAt(const vcg::Point3 & point,const vcg::Point3 & up); @@ -264,6 +267,16 @@ void Shot::SetViewPoint(const vcg::Point3 & viewpoint) } //--- +/// GET fov from focal +template +float Shot::GetFovFromFocal() +{ + double viewportYMm= Intrinsics.PixelSizeMm[1]* Intrinsics.ViewportPx[1]; + return 2*(vcg::math::ToDeg(atanf(viewportYMm/(2*Intrinsics.FocalMm)))); +} + +//--- + /// GET the i-th axis of the coordinate system of the camera template vcg::Point3 Shot::Axis(const int & i) const