<commit_before>/*
 * Copyright (C) 2016 Fondazione Istituto Italiano di Tecnologia
 *
 * Licensed under either the GNU Lesser General Public License v3.0 :
 * https://www.gnu.org/licenses/lgpl-3.0.html
 * or the GNU Lesser General Public License v2.1 :
 * https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
 * at your option.
 */

#ifndef IDYNTREE_IRRLICHT_UTILS_H
#define IDYNTREE_IRRLICHT_UTILS_H

#include <iDynTree/Model/SolidShapes.h>
#include <iDynTree/Visualizer.h>

#include <irrlicht.h>

#include <Eigen/Core>
#include <Eigen/LU>

#include <iDynTree/Core/EigenHelpers.h>

#include "FloorGridSceneNode.h"

#include <cmath>

namespace iDynTree
{

inline irr::video::SColorf idyntree2irrlicht(iDynTree::ColorViz color)
{
    return irr::video::SColorf(color.r,color.g,color.b,color.a);
}

inline iDynTree::ColorViz  irrlicht2idyntree(irr::video::SColorf color)
{
    return iDynTree::ColorViz((double)color.r,(double)color.g,(double)color.b,(double)color.a);
}


inline irr::core::vector3df idyntree2irr_rpy(const iDynTree::Vector3 & vecId)
{
    double kRad2deg = 180/M_PI;
    return irr::core::vector3df(kRad2deg*vecId(0),kRad2deg*vecId(1),kRad2deg*vecId(2));
}

inline irr::core::vector3df idyntree2irr_pos(const iDynTree::Vector3 & vecId)
{
    return irr::core::vector3df(vecId(0),vecId(1),vecId(2));
}

inline  iDynTree::Position irr2idyntree_pos(const irr::core::vector3df & vecIrr)
{
    return iDynTree::Position(vecIrr.X,vecIrr.Y,vecIrr.Z);
}

inline iDynTree::Vector3 irr2idyntree_rpy(const irr::core::vector3df & vecIrr)
{
    double kDeg2rad = M_PI/180;
    iDynTree::Vector3 ret;
    ret(0) = kDeg2rad*vecIrr.X;
    ret(1) = kDeg2rad*vecIrr.Y;
    ret(2) = kDeg2rad*vecIrr.Z;
    return ret;
}

inline iDynTree::Rotation irr2idyntree_rot(const irr::core::vector3df & rotIrr)
{
    iDynTree::Vector3 rpy = irr2idyntree_rpy(rotIrr);
    return iDynTree::Rotation::RPY(rpy(0),rpy(1),rpy(2));
}

inline const irr::core::vector3df idyntree2irr_rot(const iDynTree::Rotation & rot)
{
    return idyntree2irr_rpy(rot.asRPY());
}

inline irr::video::SMaterial idyntree2irr(const iDynTree::Vector4 & rgbaMaterialId)
{
    double ambientCoeff = 1.0;
    double diffuseCoeff = 1.0;
    irr::video::SMaterial ret;
    ret.AmbientColor = irr::video::SColorf(ambientCoeff*rgbaMaterialId(0),
                                           ambientCoeff*rgbaMaterialId(1),<commit_msg>Decrease the ambientCoeff in the idyntree2irr() method<commit_after>/*
 * Copyright (C) 2016 Fondazione Istituto Italiano di Tecnologia
 *
 * Licensed under either the GNU Lesser General Public License v3.0 :
 * https://www.gnu.org/licenses/lgpl-3.0.html
 * or the GNU Lesser General Public License v2.1 :
 * https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
 * at your option.
 */

#ifndef IDYNTREE_IRRLICHT_UTILS_H
#define IDYNTREE_IRRLICHT_UTILS_H

#include <EMaterialTypes.h>
#include <iDynTree/Model/SolidShapes.h>
#include <iDynTree/Visualizer.h>

#include <irrlicht.h>

#include <Eigen/Core>
#include <Eigen/LU>

#include <iDynTree/Core/EigenHelpers.h>

#include "FloorGridSceneNode.h"

#include <cmath>

namespace iDynTree
{

inline irr::video::SColorf idyntree2irrlicht(iDynTree::ColorViz color)
{
    return irr::video::SColorf(color.r,color.g,color.b,color.a);
}

inline iDynTree::ColorViz  irrlicht2idyntree(irr::video::SColorf color)
{
    return iDynTree::ColorViz((double)color.r,(double)color.g,(double)color.b,(double)color.a);
}


inline irr::core::vector3df idyntree2irr_rpy(const iDynTree::Vector3 & vecId)
{
    double kRad2deg = 180/M_PI;
    return irr::core::vector3df(kRad2deg*vecId(0),kRad2deg*vecId(1),kRad2deg*vecId(2));
}

inline irr::core::vector3df idyntree2irr_pos(const iDynTree::Vector3 & vecId)
{
    return irr::core::vector3df(vecId(0),vecId(1),vecId(2));
}

inline  iDynTree::Position irr2idyntree_pos(const irr::core::vector3df & vecIrr)
{
    return iDynTree::Position(vecIrr.X,vecIrr.Y,vecIrr.Z);
}

inline iDynTree::Vector3 irr2idyntree_rpy(const irr::core::vector3df & vecIrr)
{
    double kDeg2rad = M_PI/180;
    iDynTree::Vector3 ret;
    ret(0) = kDeg2rad*vecIrr.X;
    ret(1) = kDeg2rad*vecIrr.Y;
    ret(2) = kDeg2rad*vecIrr.Z;
    return ret;
}

inline iDynTree::Rotation irr2idyntree_rot(const irr::core::vector3df & rotIrr)
{
    iDynTree::Vector3 rpy = irr2idyntree_rpy(rotIrr);
    return iDynTree::Rotation::RPY(rpy(0),rpy(1),rpy(2));
}

inline const irr::core::vector3df idyntree2irr_rot(const iDynTree::Rotation & rot)
{
    return idyntree2irr_rpy(rot.asRPY());
}

inline irr::video::SMaterial idyntree2irr(const iDynTree::Vector4 & rgbaMaterialId)
{
    double ambientCoeff = 0.6;
    double diffuseCoeff = 1.0;
    irr::video::SMaterial ret;
    ret.AmbientColor = irr::video::SColorf(ambientCoeff*rgbaMaterialId(0),
                                           ambientCoeff*rgbaMaterialId(1),
{'fraction_non_alphanumeric': 0.13993808049535603, 'fraction_numerical': 0.02868937048503612, 'mean_word_length': 5.149746192893401, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2962162', 'n_tokens_mistral': 2030, 'n_tokens_neox': 1979, 'n_words': 291}