void rt_tri(SceneHandle voidscene, void * tex, apivector v0, apivector v1, apivector v2) { scenedef * scene = (scenedef *) voidscene; object * o = newtri(tex, v0, v1, v2); /* don't add degenerate triangles */ if (o != NULL) { add_bounded_object(scene, o); } }
void rt_tri(void * tex, vector v0, vector v1, vector v2) { object * trn; trn = newtri(tex, (vector)v0, (vector)v1, (vector)v2); if (trn != NULL) { add_object(trn); } }
void rt_tri3fv(SceneHandle voidscene, void * tex, const float *v0, const float *v1, const float *v2) { scenedef * scene = (scenedef *) voidscene; vector vv0, vv1, vv2; object * o; vv0.x = v0[0]; vv0.y = v0[1]; vv0.z = v0[2]; vv1.x = v1[0]; vv1.y = v1[1]; vv1.z = v1[2]; vv2.x = v2[0]; vv2.y = v2[1]; vv2.z = v2[2]; o = newtri(tex, vv0, vv1, vv2); /* don't add degenerate triangles */ if (o != NULL) { add_bounded_object(scene, o); } }
rsurf_iso_contouring::rsurf_iso_contouring(const rsurf_data& data,const std::size_t& rsIndex) :iso_contouring_data(new t_iso_contouring_data()) { //Initialisation std::size_t tsSize(0); std::size_t nodesSize(0); std::size_t nbtimestep(0); std::size_t nbfaces(0); std::size_t idstep(0); std::size_t vertices[3]={0,0,0}; std::size_t records(0); float timestep(0.f); float energy(0.f); float totenergy(0.f); std::string rs_name; std::string recordType; int rs_xmlid(0); bool converttodb=false; data.GetRsInfo(rsIndex,nbfaces,rs_name,rs_xmlid); data.GetFileInfos(tsSize,nodesSize,nbtimestep,timestep,recordType); if(recordType=="SPL_STANDART" || recordType=="SPL_GAIN") converttodb=true; //Passage de valeur de surface vers des valeurs de sommets std::vector<float> vertices_lvl(nodesSize,0.f); std::vector<unsigned int> vertices_countlinkedfaces(nodesSize,0); std::vector<bool> face_useforcalculation(nbfaces,true); for(std::size_t idface=0;idface<nbfaces;idface++) { data.GetFaceInfo(rsIndex,idface,vertices[0],vertices[1],vertices[2],records); //Cumul de l'energie sur le temps totenergy=0; for(std::size_t idrecord=0;idrecord<records;idrecord++) { data.GetFaceEnergy(rsIndex,idface,idrecord,idstep,energy); totenergy+=energy; } if(totenergy==0 || totenergy==std::numeric_limits<float>::infinity() || -totenergy==std::numeric_limits<float>::infinity()) { face_useforcalculation[idface]=false; }else{ vertices_countlinkedfaces[vertices[0]]+=1; vertices_countlinkedfaces[vertices[1]]+=1; vertices_countlinkedfaces[vertices[2]]+=1; vertices_lvl[vertices[0]]+=totenergy; vertices_lvl[vertices[1]]+=totenergy; vertices_lvl[vertices[2]]+=totenergy; } } //Division des valeurs par leurs nombre de contributeurs et conversion en dB for(std::size_t idvert=0;idvert<nodesSize;idvert++) { if(vertices_countlinkedfaces[idvert]>0) vertices_lvl[idvert]/=vertices_countlinkedfaces[idvert]; if(converttodb && vertices_lvl[idvert]>0) vertices_lvl[idvert]=10*log10(vertices_lvl[idvert]/pow(10.f,-12.f)); } //Initialisation des variables de la classe iso_contouring_data->minValue=vertices_lvl[vertices[0]]; iso_contouring_data->maxValue=iso_contouring_data->minValue; vec3 A,B,C; for(std::size_t idface=0;idface<nbfaces;idface++) { data.GetFaceInfo(rsIndex,idface,vertices[0],vertices[1],vertices[2],records); data.GetNodePositionValue(vertices[0],A.x,A.y,A.z); data.GetNodePositionValue(vertices[1],B.x,B.y,B.z); data.GetNodePositionValue(vertices[2],C.x,C.y,C.z); t_tri_data newtri(A,B,C,vertices_lvl[vertices[0]],vertices_lvl[vertices[1]],vertices_lvl[vertices[2]]); newtri.useInIsoLines=face_useforcalculation[idface]; iso_contouring_data->tri_grid.push_back(newtri); FINDMINMAX_RSURF(vertices_lvl[vertices[0]],vertices_lvl[vertices[1]],vertices_lvl[vertices[2]],iso_contouring_data->minValue,iso_contouring_data->maxValue); } }