int main(void) { ios::sync_with_stdio(false); string s; int t; while (cin >> s >> t, s != "0") { State begin = s.begin(); Sequence *tree = expr(begin); cout << tree->find(t) << endl; delete tree; } return 0; }
void Sculptor::selectPoints(const Ray * incident) { m_active->reset(); m_active->incidentRay = *incident; Sequence<Coord3> added; BoundingBox touchedBox; if(!m_march.begin(*incident)) return; while(!m_march.end()) { const std::deque<Vector3F> coords = m_march.touched(selectRadius(), touchedBox); std::deque<Vector3F>::const_iterator it = coords.begin(); for(; it != coords.end(); ++it) { const Coord3 c = m_tree->gridCoord((const float *)&(*it)); /// already tested if(added.find(c)) continue; added.insert(c); Pair<Entity *, Entity> sr = m_tree->findEntity(c); if(sr.index) { Array<int, VertexP> * pl = static_cast<Array<int, VertexP> * >(sr.index); intersect(pl, *incident); } } float tmin, tmax; touchedBox.intersect(*incident, &tmin, &tmax); /// std::cout<<" tmin "<<tmin<<" "<<m_active->meanDepth(); if((tmin - m_active->minDepth() ) > selectRadius() ) { break; } m_march.step(); } m_active->finish(); }