Go to the documentation of this file.00001
00002
00003
00004
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