Base: Add ComplexGeoData::centerOfGravity helper

This adds a simple quality of life helper returning center of gravity as
std::optional instead of C style method accepting reference and
returning bool to indicate method success.
This commit is contained in:
Kacper Donat
2024-11-11 17:54:29 +01:00
parent 88141d6dce
commit 2a69e3d878
2 changed files with 14 additions and 0 deletions

View File

@@ -184,6 +184,17 @@ bool ComplexGeoData::getCenterOfGravity(Base::Vector3d& unused) const
return false;
}
std::optional<Base::Vector3d> ComplexGeoData::centerOfGravity() const
{
Base::Vector3d centerOfGravity;
if (getCenterOfGravity(centerOfGravity)) {
return centerOfGravity;
}
return {};
}
const std::string& ComplexGeoData::elementMapPrefix()
{
static std::string prefix(ELEMENT_MAP_PREFIX);