void QueryResultIterator::next() { if (tetrahedron_key.size()==0){ face_key = FaceKey((unsigned int) -1); } else { while (tetrahedron_key.size()>0){ SimplexSet<FaceKey> faces = mesh->get_faces(tetrahedron_key) - face_key; double oldDist = dist; if (tetWalking(faces)){ return; } bool found_new_tet = oldDist != dist; if (found_new_tet){ continue; } break; } } face_key = FaceKey((unsigned int) -1); }
void QueryResultIterator::next() { if (tetrahedron_key.size()==0){ face_key = FaceKey((unsigned int) -1); } else { while (tetrahedron_key.size()>0){ SimplexSet<FaceKey> faces = mesh->get(tetrahedron_key.front()).face_keys() - face_key; double newDist = std::numeric_limits<double>::max(); for (FaceKey current_face_key : faces) { auto & face = mesh->get(current_face_key); auto nodePos = mesh->get_pos(face.node_keys()); if (ray.intersect_triangle(nodePos[0], nodePos[1], nodePos[2], newDist)) { face_key = current_face_key; tetrahedron_key = face.get_co_boundary() - tetrahedron_key; if (newDist >=0 && (query_type == QueryType::All || (query_type == QueryType::Interface && face.is_interface()) || (query_type == QueryType::Boundary && face.is_boundary()))){ dist = newDist; return; } break; } } bool notFound = newDist == std::numeric_limits<double>::max() ; if (notFound){ #ifdef DEBUG auto & face = mesh->get(face_key); auto node_pos = mesh->get_pos(face.node_keys()); for(auto n : node_pos){ std::cerr << n <<" dist to ray "<< ray.distance(n) << std::endl; } assert(false); #endif face_key = FaceKey((unsigned int) -1); return; } } } face_key = FaceKey((unsigned int) -1); }
QueryResultIterator::QueryResultIterator() { face_key = FaceKey((unsigned int) -1); }