Skip to content
Snippets Groups Projects
Commit 9df40adb authored by Raphael Grimm's avatar Raphael Grimm
Browse files

Allow viz::Box to be set to / constructed from simox::OrientedBoxBase

parent 15b04488
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@
#include <SimoxUtility/math/normal/normal_to_mat4.h>
#include <SimoxUtility/math/convert/rpy_to_mat3f.h>
#include <SimoxUtility/math/pose/transform.h>
#include <SimoxUtility/shapes/OrientedBoxBase.h>
#include <Eigen/Core>
#include <Eigen/Geometry>
......@@ -69,6 +70,32 @@ namespace armarx::viz
{
return size(Eigen::Vector3f(s, s, s));
}
Box& set(const simox::OrientedBoxBase<float>& b)
{
size(b.dimensions());
return pose(b.transformation_centered());
}
Box& set(const simox::OrientedBoxBase<double>& b)
{
size(b.dimensions<float>());
return pose(b.transformation_centered<float>());
}
template<class T>
Box(const std::string& name, const simox::OrientedBoxBase<T>& b)
: ElementOps(name)
{
set(b);
}
template<class T>
Box(
const simox::OrientedBoxBase<T>& b,
const std::string& name = std::to_string(std::chrono::high_resolution_clock::now().time_since_epoch().count())
)
: Box(name, b)
{}
};
class Cylinder : public ElementOps<Cylinder, data::ElementCylinder>
......
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