concentricbumpmap.cpp

Go to the documentation of this file.
00001 
00002 #include "concentricbumpmap.h"
00003 
00004 
00005 // This actually makes the static init work.
00006 ConcentricBumpMap::StaticInit ConcentricBumpMap::m_init;
00007 
00008 Ray ConcentricBumpMap::perturb_normal(const Ray& normal, const Point3D& intersection_point)
00009 {
00010     static Point3D zero;
00011 
00012     double len = zero.distance_to(intersection_point);
00013     if(len == 0.0) 
00014     {
00015         len = 0.00001;
00016     }
00017 
00018     Vector dir(normal.direction() );
00019     double offset = sin(len * 2.0  ) / (len/2.5);
00020 
00021     dir.x += offset;
00022     dir.y += offset;
00023     // dir.z += 0.0;
00024 
00025     return Ray(normal.origin(), dir);    
00026 }
00027 

Generated on Tue Oct 30 22:12:15 2007 for mbrt by  doxygen 1.5.2