Michele Sottile: added GetFovFromFocal

This commit is contained in:
matteodelle 2010-07-21 15:54:31 +00:00
parent 0ee814c9ae
commit 3064a869cc
1 changed files with 13 additions and 0 deletions

View File

@ -169,6 +169,9 @@ public:
/// SET the viewpoint /// SET the viewpoint
void SetViewPoint(const vcg::Point3<S> & viewpoint); void SetViewPoint(const vcg::Point3<S> & viewpoint);
/// GET fov from focal
float GetFovFromFocal();
/// look at (point+up) /// look at (point+up)
void LookAt(const vcg::Point3<S> & point,const vcg::Point3<S> & up); void LookAt(const vcg::Point3<S> & point,const vcg::Point3<S> & up);
@ -264,6 +267,16 @@ void Shot<S,RotationType>::SetViewPoint(const vcg::Point3<S> & viewpoint)
} }
//--- //---
/// GET fov from focal
template <class S, class RotationType>
float Shot<S,RotationType>::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 /// GET the i-th axis of the coordinate system of the camera
template <class S, class RotationType> template <class S, class RotationType>
vcg::Point3<S> Shot<S,RotationType>::Axis(const int & i) const vcg::Point3<S> Shot<S,RotationType>::Axis(const int & i) const