master
Christophe Riccio ago%!(EXTRA string=7 years)
commit 620c951501
  1. 2
      glm/gtx/quaternion.inl
  2. 1
      glm/gtx/string_cast.inl
  3. 12
      test/gtx/gtx_string_cast.cpp

@ -45,7 +45,7 @@ namespace glm
) )
{ {
tquat<T, Q> invQuat = inverse(curr); tquat<T, Q> invQuat = inverse(curr);
return exp((log(next + invQuat) + log(prev + invQuat)) / static_cast<T>(-4)) * curr; return exp((log(next * invQuat) + log(prev * invQuat)) / static_cast<T>(-4)) * curr;
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>

@ -467,6 +467,7 @@ namespace detail
char const * LiteralStr = literal<T, std::numeric_limits<T>::is_iec559>::value(); char const * LiteralStr = literal<T, std::numeric_limits<T>::is_iec559>::value();
std::string FormatStr(detail::format("%sdualquat((%s, {%s, %s, %s}), (%s, {%s, %s, %s}))", std::string FormatStr(detail::format("%sdualquat((%s, {%s, %s, %s}), (%s, {%s, %s, %s}))",
PrefixStr, PrefixStr,
LiteralStr, LiteralStr, LiteralStr, LiteralStr,
LiteralStr, LiteralStr, LiteralStr, LiteralStr)); LiteralStr, LiteralStr, LiteralStr, LiteralStr));
return detail::format(FormatStr.c_str(), return detail::format(FormatStr.c_str(),

@ -129,12 +129,24 @@ int test_string_cast_quaternion()
} }
int test_string_cast_dual_quaternion()
{
int Error = 0;
glm::dualquat Q0 = glm::dualquat(glm::quat(1.0f, 2.0f, 3.0f, 4.0f), glm::quat(5.0f, 6.0f, 7.0f, 8.0f));
std::string S0 = glm::to_string(Q0);
Error += S0 != std::string("dualquat((1.000000, {2.000000, 3.000000, 4.000000}), (5.000000, {6.000000, 7.000000, 8.000000}))") ? 1 : 0;
return Error;
}
int main() int main()
{ {
int Error = 0; int Error = 0;
Error += test_string_cast_vector(); Error += test_string_cast_vector();
Error += test_string_cast_matrix(); Error += test_string_cast_matrix();
Error += test_string_cast_quaternion(); Error += test_string_cast_quaternion();
Error += test_string_cast_dual_quaternion();
return Error; return Error;
} }

Loading…
Cancel
Save