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

Make Box optional and update conversions

parent 751e1bec
No related branches found
No related tags found
No related merge requests found
#pragma once
#include <optional>
#include <Eigen/Core>
#include <SimoxUtility/shapes/OrientedBox.h>
......@@ -52,7 +54,7 @@ namespace armarx::objpose
IceUtil::Time timestamp = IceUtil::Time::microSeconds(-1);
/// Object bounding box in object's local coordinate frame.
simox::OrientedBoxf localOOBB;
std::optional<simox::OrientedBoxf> localOOBB;
};
using ObjectPoseSeq = std::vector<ObjectPose>;
......
......@@ -82,6 +82,17 @@ namespace armarx
oobb = {};
}
}
void objpose::fromIce(const BoxPtr& box, std::optional<simox::OrientedBox<float>>& oobb)
{
if (box)
{
oobb = fromIce(*box);
}
else
{
oobb = std::nullopt;
}
}
simox::OrientedBoxf objpose::fromIce(const Box& box)
{
......@@ -97,6 +108,15 @@ namespace armarx
box.extents = new Vector3(oobb.dimensions());
}
void objpose::toIce(BoxPtr& box, const std::optional<simox::OrientedBox<float>>& oobb)
{
if (oobb)
{
box = new Box();
toIce(*box, *oobb);
}
}
objpose::Box objpose::toIce(const simox::OrientedBoxf& oobb)
{
objpose::Box box;
......
......@@ -28,8 +28,11 @@ namespace armarx::objpose
void fromIce(const Box& box, simox::OrientedBox<float>& oobb);
void fromIce(const BoxPtr& box, std::optional<simox::OrientedBox<float>>& oobb);
simox::OrientedBox<float> fromIce(const Box& box);
void toIce(BoxPtr& box, const std::optional<simox::OrientedBox<float>>& oobb);
void toIce(Box& box, const simox::OrientedBox<float>& oobb);
Box toIce(const simox::OrientedBox<float>& oobb);
......
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