Пример #1
0
 inline
 unsigned int operator()(const TPoint3D &aNormal)  const {
   double lambertianIntensity = std::max(aNormal.dot(myLightSourceDirection), 0.0);
   double alpha = acos(((myLightSourceDirection+Z3i::RealPoint(0,0,1.0))/2.0).dot(aNormal/aNormal.norm()));
   double specularIntensity =  exp(-alpha*alpha/(2.0*mySigma));
   double resu = myKld*lambertianIntensity+myKls*specularIntensity;
   
   resu = std::max(resu, 0.0);
   resu = std::min(resu, 1.0);
   return resu*std::numeric_limits<typename TImage2D::Value>::max();
 }
Пример #2
0
 inline
 unsigned int operator()(const TPoint3D &aNormal, const Z2i::Point &aPoint, const double h)  const
 {
   TPoint3D l;
   
   Z3i::RealPoint posL (aPoint[0], aPoint[1], h);
   l = -posL+myLightSourcePosition;
   l /= l.norm();
   int intensity = aNormal.dot(l)*std::numeric_limits<typename TImage2D::Value>::max();
   return intensity>0? intensity:0;
 }
Пример #3
0
 inline
 unsigned int operator()(const TPoint3D &aNormal, const Z2i::Point &aPoint, const double h)  const {
   TPoint3D l;
   Z3i::RealPoint posL (aPoint[0], aPoint[1], h);
   l = -posL+myLightSourcePosition;
   l /= l.norm();
 
   double lambertianIntensity = std::max(aNormal.dot(l), 0.0);
   double alpha = acos(((l+Z3i::RealPoint(0,0,1.0))/2.0).dot(aNormal/aNormal.norm()));
   double specularIntensity =  exp(-alpha*alpha/(2.0*mySigma));
   double resu = myKld*lambertianIntensity+myKls*specularIntensity;
   
   resu = std::max(resu, 0.0);
   resu = std::min(resu, 1.0);
   return resu*std::numeric_limits<typename TImage2D::Value>::max();
 }
Пример #4
0
 inline
 unsigned int operator()(const TPoint3D &aNormal)  const
 {
   int intensity = aNormal.dot(myLightSourceDirection)*std::numeric_limits<typename TImage2D::Value>::max();
   return intensity>0? intensity:0;
 }