예제 #1
0
파일: io.cpp 프로젝트: drussel/imp
Sphere3Ds read_spheres(base::TextInput oin) {
  Sphere3Ds ret;
  std::istream &in=oin;
  while (true) {
    char buf[2000];
    in.getline(buf, 2000);
    if (!in) break;;
    if (buf[0]=='#') continue;
    std::istringstream iss(buf);
    IMP::Float x,y,z, r;
    iss >> x >> y >> z >> r;
    if (!iss) {
      throw IMP::base::ValueException((std::string("Unable to parse line ")
                                 + buf).c_str());
    }
    Sphere3D v(Vector3D(x,y,z), r);
    ret.push_back(v);
  }
  return ret;
}