Beispiel #1
0
bool ODERigidObject::WriteState(File& f) const
{
  //TODO: use body quaternion
  Vector3 w,v;
  const dReal* pos=dBodyGetPosition(bodyID);
  const dReal* q=dBodyGetQuaternion(bodyID);
  GetVelocity(w,v);
    
  if(!WriteArrayFile(f,pos,3)) return false;
  if(!WriteArrayFile(f,q,4)) return false;
  if(!WriteFile(f,w)) return false;
  if(!WriteFile(f,v)) return false;
  return true;
}
Beispiel #2
0
bool WriteFile(File& f,const vector<T>& v)
{
  if(!WriteFile(f,v.size())) return false;
  if(!v.empty())
    if(!WriteArrayFile(f,&v[0],v.size())) return false;
  return true;
}
Beispiel #3
0
bool SplineBase<Key,Point>::Write(File& f) const
{
	if(!SplineTimeBase::Write(f)) return false;
	//if(!WriteArrayFile(f,points,getNumKeys())) return false;
	if(!WriteArrayFile(f,&keys[0],getNumKeys())) return false;
	return true;
}
Beispiel #4
0
bool WriteFile(File& f,const string& s)
{
  size_t n=s.length();
  if(!WriteFile(f,n)) return false;
  if(n > 0)
    if(!WriteArrayFile(f,&s[0],s.length())) return false;
  return true;
}
Beispiel #5
0
bool SplineTimeBase::Write(File& f) const
{
	int nt = times.size();
	if(!WriteFile(f,nt)) return false;
	if(!WriteFile(f,flags)) return false;
	//if(!WriteArrayFile(f,times,times.size())) return false;
	if(!WriteArrayFile(f,&times[0],times.size())) return false;
	return true;
}
Beispiel #6
0
bool ODERigidObject::WriteState(File& f) const
{
  //TODO: use body quaternion
  Vector3 w,v;
  const dReal* pos=dBodyGetPosition(bodyID);
  const dReal* q=dBodyGetQuaternion(bodyID);
  GetVelocity(w,v);
  //do we need this?
  const dReal* frc=dBodyGetForce(bodyID);
  const dReal* trq=dBodyGetTorque(bodyID);
    
  if(!WriteArrayFile(f,pos,3)) return false;
  if(!WriteArrayFile(f,q,4)) return false;
  if(!WriteFile(f,w)) return false;
  if(!WriteFile(f,v)) return false;
  if(!WriteArrayFile(f,frc,3)) return false;
  if(!WriteArrayFile(f,trq,3)) return false;
  return true;
}