33 #ifndef DART_GUI_OSG_UTILS_HPP_
34 #define DART_GUI_OSG_UTILS_HPP_
36 #include <Eigen/Geometry>
41 template <
typename Scalar>
43 const Eigen::Transform<Scalar, 3, Eigen::Isometry>& tf)
65 template <
typename Derived>
88 template <
typename Derived>
91 return ::osg::Vec3f(vec[0], vec[1], vec[2]);
95 template <
typename Derived>
98 return ::osg::Vec3d(vec[0], vec[1], vec[2]);
102 template <
typename Derived>
103 typename std::conditional<
104 std::is_same<typename Derived::Scalar, float>::value,
109 using Vec3 =
typename std::conditional<
110 std::is_same<typename Derived::Scalar, float>::value,
114 return Vec3(vec[0], vec[1], vec[2]);
120 return Eigen::Vector3f(vec[0], vec[1], vec[2]);
126 return Eigen::Vector3d(vec[0], vec[1], vec[2]);
130 template <
typename Derived>
133 return ::osg::Vec4f(vec[0], vec[1], vec[2], vec[3]);
137 template <
typename Derived>
140 return ::osg::Vec4d(vec[0], vec[1], vec[2], vec[3]);
144 template <
typename Derived>
146 std::is_same<typename Derived::Scalar, float>::value,
151 return std::conditional<
152 std::is_same<typename Derived::Scalar, float>::value,
154 ::osg::Vec4d>(vec[0], vec[1], vec[2], vec[3]);
160 return Eigen::Vector4f(vec[0], vec[1], vec[2], vec[3]);
166 return Eigen::Vector4d(vec[0], vec[1], vec[2], vec[3]);
std::string type
Definition: SdfParser.cpp:82
Eigen::Vector3f osgToEigVec3(const ::osg::Vec3f &vec)
Definition: Utils.hpp:118
::osg::Vec4f eigToOsgVec4f(const Eigen::MatrixBase< Derived > &vec)
Definition: Utils.hpp:131
::osg::Vec3f eigToOsgVec3f(const Eigen::MatrixBase< Derived > &vec)
Definition: Utils.hpp:89
std::conditional< std::is_same< typename Derived::Scalar, float >::value, ::osg::Vec4f, ::osg::Vec4d > eigToOsgVec4(const Eigen::MatrixBase< Derived > &vec)
Definition: Utils.hpp:149
::osg::Vec3d eigToOsgVec3d(const Eigen::MatrixBase< Derived > &vec)
Definition: Utils.hpp:96
std::conditional< std::is_same< typename Derived::Scalar, float >::value, ::osg::Vec3f, ::osg::Vec3d >::type eigToOsgVec3(const Eigen::MatrixBase< Derived > &vec)
Definition: Utils.hpp:107
::osg::Vec4d eigToOsgVec4d(const Eigen::MatrixBase< Derived > &vec)
Definition: Utils.hpp:138
::osg::Matrix eigToOsgMatrix(const Eigen::Transform< Scalar, 3, Eigen::Isometry > &tf)
Definition: Utils.hpp:42
Eigen::Vector4f osgToEigVec4(const ::osg::Vec4f &vec)
Definition: Utils.hpp:158