•Nel nostro caso occorre una
–map<vertici,normali> NN;
–e il codice per sommare tutte le
normali
incidenti in un vertice diventa:
•
• map<Point3f,Point3f>
NN; //the vertex->normal map
• vector<Triangle>::iterator
i;
• int
j;
•
• // accumulate normals per vertex
• for(i=T.begin();i!=T.end();++i)
•
for(j=0;j<3;++j)
•
NN[(*i).v[j]]+=(*i).n[j];
•