2014-03-15 22:06:16 +00:00
|
|
|
#include "Util.h"
|
|
|
|
|
|
|
|
std::string strToUpper(const char* from)
|
|
|
|
{
|
|
|
|
std::string str(from);
|
|
|
|
for(unsigned int i = 0; i < str.size(); i++)
|
|
|
|
str[i] = toupper(from[i]);
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string& strToUpper(std::string& str)
|
|
|
|
{
|
|
|
|
for(unsigned int i = 0; i < str.size(); i++)
|
|
|
|
str[i] = toupper(str[i]);
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string strToUpper(const std::string& str)
|
|
|
|
{
|
|
|
|
return strToUpper(str.c_str());
|
2014-03-19 20:03:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
float round(float num)
|
|
|
|
{
|
|
|
|
return (float)((int)(num + 0.5f));
|
|
|
|
}
|
|
|
|
|
|
|
|
Eigen::Affine3f& roundMatrix(Eigen::Affine3f& mat)
|
|
|
|
{
|
|
|
|
mat.translation()[0] = round(mat.translation()[0]);
|
|
|
|
mat.translation()[1] = round(mat.translation()[1]);
|
|
|
|
return mat;
|
|
|
|
}
|
|
|
|
|
|
|
|
Eigen::Affine3f roundMatrix(const Eigen::Affine3f& mat)
|
|
|
|
{
|
|
|
|
Eigen::Affine3f ret = mat;
|
|
|
|
roundMatrix(ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
Eigen::Vector3f roundVector(const Eigen::Vector3f& vec)
|
|
|
|
{
|
|
|
|
Eigen::Vector3f ret = vec;
|
|
|
|
ret[0] = round(ret[0]);
|
|
|
|
ret[1] = round(ret[1]);
|
|
|
|
ret[2] = round(ret[2]);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
Eigen::Vector2f roundVector(const Eigen::Vector2f& vec)
|
|
|
|
{
|
|
|
|
Eigen::Vector2f ret = vec;
|
|
|
|
ret[0] = round(ret[0]);
|
|
|
|
ret[1] = round(ret[1]);
|
|
|
|
return ret;
|
|
|
|
}
|