42 double r{ 0 }, l{ 0 };
43 if (xml_element->QueryDoubleAttribute(
"length", &(l)) != tinyxml2::XML_SUCCESS || !(l > 0))
44 std::throw_with_nested(std::runtime_error(
"Cone: Missing or failed parsing attribute 'length'!"));
46 if (xml_element->QueryDoubleAttribute(
"radius", &(
r)) != tinyxml2::XML_SUCCESS || !(
r > 0))
47 std::throw_with_nested(std::runtime_error(
"Cone: Missing or failed parsing attribute 'radius'!"));
49 return std::make_shared<tesseract_geometry::Cone>(
r, l);
52 tinyxml2::XMLElement*
writeCone(
const std::shared_ptr<const tesseract_geometry::Cone>& cone, tinyxml2::XMLDocument& doc)
55 std::throw_with_nested(std::runtime_error(
"Cone is nullptr and cannot be converted to XML"));
57 xml_element->SetAttribute(
"length",
toString(cone->getLength()).c_str());
58 xml_element->SetAttribute(
"radius",
toString(cone->getRadius()).c_str());