bool parseSphere(Sphere &s, TiXmlElement *c) { s.clear(); s.type = Geometry::SPHERE; if (!c->Attribute("radius")) { CONSOLE_BRIDGE_logError("Sphere shape must have a radius attribute"); return false; } try { s.radius = boost::lexical_cast<double>(c->Attribute("radius")); } catch (boost::bad_lexical_cast &e) { std::stringstream stm; stm << "radius [" << c->Attribute("radius") << "] is not a valid float: " << e.what(); CONSOLE_BRIDGE_logError(stm.str().c_str()); return false; } return true; }
bool parseSphere(Sphere &s, TiXmlElement *c) { s.clear(); s.type = Geometry::SPHERE; if (!c->Attribute("radius")) { logError("Sphere shape must have a radius attribute"); return false; } if( !stringToDouble(c->Attribute("radius"),s.radius) ) { std::stringstream stm; stm << "radius [" << c->Attribute("radius") << "] is not a valid float: "; logError(stm.str().c_str()); return false; } return true; }