示例#1
0
文件: CTRNN.cpp 项目: buhrmann/dynmx
//----------------------------------------------------------------------------------------------------------------------
void CTRNN::toXml(ci::XmlTree& xml)
{
  ci::XmlTree nn("CTRNN","");
  nn.setAttribute("Size", size);
  nn.setAttribute("Weight", getWeightSum());
  
  for(int i = 0; i < size; ++i)
  {
    ci::XmlTree n("Neuron","");
    n.setAttribute("Index", i);
    n.setAttribute("Bias", biases[i]);
    n.setAttribute("TimeConstant", taus[i]);
    n.setAttribute("Gain", gains[i]);
    
    for(int j = 0; j < size; ++j)
    {
      ci::XmlTree w("Weight", toString(weights[j][i]));
      w.setAttribute("From", j);
      n.push_back(w);
    }

    nn.push_back(n);
  }
  
  xml.push_back(nn);
}
Bar::Bar(const ci::XmlTree &xml)
: begin(fromString<vec2>(xml.getChild("begin").getValue())),
	end(fromString<vec2>(xml.getChild("end").getValue())),
	time(fromString<int>(xml.getChild("time").getValue())),
	texture_begin(fromString<float>(xml.getChild("texture_begin").getValue())),
	texture_end(fromString<float>(xml.getChild("texture_end").getValue())),
	repeats(fromString<int>(xml.getChild("repeats").getValue()))
{}
示例#3
0
//----------------------------------------------------------------------------------------------------------------------  
void SMCAgent::toXml(ci::XmlTree& xml)
{
  if(m_distanceSensor != NULL)
    m_distanceSensor->toXml(xml);
  
  xml.push_back(ci::XmlTree("MaxSpeed", toString(m_maxSpeed)));
  float maxAngSpeed = radiansToDegrees(m_maxAngularSpeed);
  xml.push_back(ci::XmlTree("MaxAngularSpeed", toString(maxAngSpeed)));
  xml.push_back(ci::XmlTree("MaxPosition", toString(m_maxPosition)));
  xml.push_back(ci::XmlTree("PositionWraps", toString(m_positionWraps)));
  float maxAngle = radiansToDegrees(m_maxAngle);
  xml.push_back(ci::XmlTree("MaxAngle", toString(maxAngle)));
  xml.push_back(ci::XmlTree("AngleWraps", toString(m_angleWraps)));
    
  // ctrnn
  m_ctrnn->toXml(xml);
}