void vrlib_wand_posvec (float wand_pos[], float wand_vec[]) { CAVEGetPosition (CAVE_WAND, wand_pos); CAVEGetVector (CAVE_WAND_FRONT, wand_vec); return; }
void Common::SelectParticle() { // cout << "----------------------" << endl; // cout << "SelectParticle: r: " << r << endl; vector<int> curlist = data.getCurrentList(); vector<int>::iterator p; Particle candPt; double candPtDist = TARGET_DIST_THRESH/scale; float wandpos_tmp1[3],wandpos_tmp2[3]; float wandvec_tmp1[3],wandvec_tmp2[3]; CAVEGetPosition(CAVE_WAND_NAV, wandpos_tmp1); CAVEGetVector(CAVE_WAND_FRONT_NAV,wandvec_tmp1); PARTICLE_POS candPos; PARTICLE_POS crossPos; for(int i=0;i<3;i++){ candPos.pos[i] = -100; } for (int i = 0; i < 3; i++) { wandpos_tmp1[i] -= (float) ORIG[i]; } coordtrans(wandpos_tmp1,wandpos_tmp2,rot); coordtrans(wandvec_tmp1,wandvec_tmp2,rot); for (p = curlist.begin(); p != curlist.end(); p++) { PARTICLE_POS pos; double dist; if (*p < 0) { continue; } Particle *pt = data.getData(*p); pt->extrapolate(t_dat,scale,&pos); for (int i = 0; i < 3; i++) { crossPos.pos[i] = wandpos_tmp2[i]+(BEAM_SCALE*wandvec_tmp2[i]); } dist = GetParticleDist(&pos,&crossPos); if(dist < TARGET_DIST_THRESH/scale&&dist < candPtDist){ candPt = *pt; for(int i=0;i<3;i++){ candPos.pos[i] = pos.pos[i]; } } } if(candPt.getId()==-1){ return; } if(target_id.empty()|| (target_id.front()!=candPt.getId()&&target_id.back()!=candPt.getId())){ target_id.push(candPt.getId()); vector<TARGET_POS> pos_vector; traj.push(pos_vector); } if(target_id.size()==3 ||(target_id.size()==2&&target_id.front()==target_id.back()) ){ target_id.pop(); traj.pop(); } return; }
void vrlib_head_pos (float head_pos[]) { CAVEGetPosition (CAVE_HEAD_NAV, pos); return; }