Beispiel #1
0
/////////////READ/////////////////////////////////////////
//
void
SpatialConstraint::read(std::istream &in) {

  in.setf(std::ios::skipws);
  while(in.peek() == COMMENT)  // ignore comments
      in.ignore(10000,'\n');
  in >> a_ >> d_ ;
  if(!in.good())
    throw SpatialFailure("SpatialConstraint:read: Could not read constraint");
  a_.normalize();
  s_ = acos(d_);
  if     (d_ <= -gEpsilon) sign_ = nEG;
  else if(d_ >=  gEpsilon) sign_ = pOS;
  else                sign_ = zERO;
}
Beispiel #2
0
/////////////READ/////////////////////////////////////////
//
void
SpatialConvex::read(std::istream &in) {
  size_t nconstr;
  SpatialConstraint constr;
  
  in.setf(std::ios::skipws);
  while(in.peek() == COMMENT)  // ignore comments
    in.ignore(10000,'\n');
  in >> nconstr ; in.ignore(); // ignore "\n"
  if(!in.good())
    throw SpatialFailure("SpatialConvex:read: Could not read constraint");
  for(size_t i = 0; i < nconstr; i++) {
    if(in.eof())
      throw SpatialFailure("SpatialConvex:read: Premature end-of-file");
    in >> constr;
    if(!in.good())
      throw SpatialFailure("SpatialConvex:read: Could not read constraint");
    add(constr);
  }
}