43 if (xml_element->QueryDoubleAttribute(
"radius", &(radius)) != tinyxml2::XML_SUCCESS || !(radius > 0))
44 std::throw_with_nested(std::runtime_error(
"Sphere: Missing or failed parsing attribute radius!"));
46 return std::make_shared<tesseract_geometry::Sphere>(radius);
49 tinyxml2::XMLElement*
writeSphere(
const std::shared_ptr<const tesseract_geometry::Sphere>& sphere,
50 tinyxml2::XMLDocument& doc)
52 if (sphere ==
nullptr)
53 std::throw_with_nested(std::runtime_error(
"Sphere is nullptr and cannot be converted to XML"));
56 xml_element->SetAttribute(
"radius",
toString(sphere->getRadius()).c_str());