Skip to content
Snippets Groups Projects
Commit 6c1dd70e authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Add access to AABB

parent fe67711a
No related branches found
No related tags found
1 merge request!71Object pose observer
#include "ObjectFinder.h" #include "ObjectFinder.h"
#include <SimoxUtility/filesystem/list_directory.h> #include <SimoxUtility/filesystem/list_directory.h>
#include <SimoxUtility/json.h>
#include <SimoxUtility/shapes/AxisAlignedBoundingBox.h>
#include <ArmarXCore/core/exceptions/local/ExpressionException.h> #include <ArmarXCore/core/exceptions/local/ExpressionException.h>
#include <ArmarXCore/core/system/cmake/CMakePackageFinder.h> #include <ArmarXCore/core/system/cmake/CMakePackageFinder.h>
...@@ -207,6 +209,21 @@ namespace armarx ...@@ -207,6 +209,21 @@ namespace armarx
return file(".obj"); return file(".obj");
} }
PackageFileLocation ObjectInfo::boundingBoxJson() const
{
return file(".json", "_bb");
}
simox::AxisAlignedBoundingBox ObjectInfo::aabb() const
{
nlohmann::json j = nlohmann::read_json(boundingBoxJson().absolutePath);
nlohmann::json jaabb = j.at("aabb");
auto min = jaabb.at("min").get<Eigen::Vector3f>();
auto max = jaabb.at("max").get<Eigen::Vector3f>();
return simox::AxisAlignedBoundingBox(min, max);
}
bool ObjectInfo::checkPaths() const bool ObjectInfo::checkPaths() const
{ {
namespace fs = std::filesystem; namespace fs = std::filesystem;
......
...@@ -4,6 +4,10 @@ ...@@ -4,6 +4,10 @@
#include <ArmarXCore/core/logging/Logging.h> #include <ArmarXCore/core/logging/Logging.h>
namespace simox
{
struct AxisAlignedBoundingBox;
}
namespace armarx namespace armarx
{ {
...@@ -82,6 +86,11 @@ namespace armarx ...@@ -82,6 +86,11 @@ namespace armarx
PackageFileLocation simoxXML() const; PackageFileLocation simoxXML() const;
PackageFileLocation wavefrontObj() const; PackageFileLocation wavefrontObj() const;
PackageFileLocation boundingBoxJson() const;
simox::AxisAlignedBoundingBox aabb() const;
/** /**
* @brief Checks the existence of expected files. * @brief Checks the existence of expected files.
* If a file is does not exist, emits a warning returns false. * If a file is does not exist, emits a warning returns false.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment