• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

FrustumOps.h

Go to the documentation of this file.
00001 // GMTL is (C) Copyright 2001-2010 by Allen Bierbaum
00002 // Distributed under the GNU Lesser General Public License 2.1 with an
00003 // addendum covering inlined code. (See accompanying files LICENSE and
00004 // LICENSE.addendum or http://www.gnu.org/copyleft/lesser.txt)
00005 
00006 #ifndef _GMTL_FRUSTUM_OPS_H_
00007 #define _GMTL_FRUSTUM_OPS_H_
00008 
00009 #include <gmtl/Defines.h>
00010 #include <gmtl/Frustum.h>
00011 #include <gmtl/Math.h>
00012 
00013 
00014 namespace gmtl
00015 {
00016 
00017 template<class DATA_TYPE>
00018 void normalize(Frustum<DATA_TYPE>& f)
00019 {
00020    for ( unsigned int i = 0; i < 6; ++i )
00021    {
00022       Vec<DATA_TYPE, 3> n = f.mPlanes[i].getNormal();
00023       DATA_TYPE o = f.mPlanes[i].getOffset();
00024       DATA_TYPE len = Math::sqrt( n[0] * n[0] + n[1] * n[1] + n[2] * n[2]);
00025       n[0] /= len;
00026       n[1] /= len;
00027       n[2] /= len;
00028       o /= len;
00029       f.mPlanes[i].setNormal(n);
00030       f.mPlanes[i].setOffset(o);
00031    }
00032 }
00033 
00034 }
00035 
00036 
00037 #endif /* _GMTL_FRUSTUM_OPS_H_ */

Generated on Sun Sep 19 2010 14:35:14 for GenericMathTemplateLibrary by  doxygen 1.7.1