added normal vector return on the RaySpherical function

This commit is contained in:
Nico Pietroni 2010-04-28 13:11:26 +00:00
parent d8cfbc5e51
commit aeff903128
1 changed files with 14 additions and 5 deletions

View File

@ -422,10 +422,10 @@ namespace vcg {
typename GRID::ScalarType alfa,beta,gamma; typename GRID::ScalarType alfa,beta,gamma;
if (f!=NULL) if (f!=NULL)
{ {
f->InterpolationParameters(int_point, alfa, beta, gamma); InterpolationParameters<FaceType,ScalarType>(*f,int_point, alfa, beta, gamma);
_normf = (f->V(0)->cN())*alfa+ _normf = (f->V(0)->cN())*alfa+
(f->V(1)->cN())*beta+ (f->V(1)->cN())*beta+
(f->V(2)->cN())*gamma ; (f->V(2)->cN())*gamma ;
} }
return f; return f;
} }
@ -439,7 +439,8 @@ namespace vcg {
const typename GRID::ScalarType & _phi_interval, const typename GRID::ScalarType & _phi_interval,
const int &n_samples, const int &n_samples,
OBJPTRCONTAINER & _objectPtrs, OBJPTRCONTAINER & _objectPtrs,
COORDCONTAINER & _pos) COORDCONTAINER & _pos,
COORDCONTAINER & _norm)
{ {
typedef typename MESH::FaceType FaceType; typedef typename MESH::FaceType FaceType;
typedef typename MESH::ScalarType ScalarType; typedef typename MESH::ScalarType ScalarType;
@ -469,7 +470,15 @@ namespace vcg {
{ {
typename GRID::CoordType pos=curr_ray.Origin()+curr_ray.Direction()*_t; typename GRID::CoordType pos=curr_ray.Origin()+curr_ray.Direction()*_t;
_objectPtrs.push_back(f); _objectPtrs.push_back(f);
_pos.push_back(pos); _pos.push_back(pos);
///find the normal
typename GRID::ScalarType alfa,beta,gamma;
InterpolationParameters<FaceType,ScalarType>(*f,pos, alfa, beta, gamma);
typename GRID::CoordType norm = (f->V(0)->cN())*alfa+
(f->V(1)->cN())*beta+
(f->V(2)->cN())*gamma ;
_norm.push_back(norm);
} }
} }
} }