c++ - Cartesian to quaternion glm -
i have vector pointing in direction need rotate, need convert quaternion first. cannot find converting cartesian coordinates quaternions in glm. such function exist?
maybe these out. can found on website in api documents v0.9.6:
glm_func_decl tvec4<t, p> glm::rotate( tquat<t,p> const &q, tvec4<t,p> const &v ) rotates 4 components vector quaternion. see glm_gtx_quaternion glm_func_decl tquat<t, p> glm::rotation( tvec3<t,p> const &orig, tvec3<t,p> const &dest ) compute rotation between 2 vectors. param orig vector, needs normalized param dest vector, needs normalized see glm_gtx_quaternion
and
template<typename t, precision p> glm_func_decl tvec3<t,p> rotate( tquat<t,p> const &q, tvec3<t,p> const &v ) template<typename t, precision p> glm_func_decl tvec4<t,p> rotate( tquat<t,p> const &q, tvec4<t,p> const &v ) template<typename t, precision p> glm_func_decl tquat<t,p> rotation( tvec3<t,p> const &orig, tvec3<t,p> const &dest ) template<typename t, precision p> glm_func_decl tquat<t,p> shortmix( tquat<t, p> const &x, tquat<t, p> const &y, t const &a ) template<typename t, precision p> glm_func_decl tquat<t,p> squad( tquat<t,p> const &q1, tquat<t,p> const &q2, tquat<t,p> const &s1, tquat<t,p> const &s2, t const &h ) template<typename t, precision p> glm_func_decl tmat3x3<t,p> tomat3( tquat<t,p> const &x ) template<typename t, precision p> glm_func_decl tmat4x4<t,p> tomat4( tquat<t,p> const &x ) template<typename t, precision p> glm_func_decl tquat<t,p> toquat( tmat3x3<t,p> const &x ) template<typename t, precision p> glm_func_decl tquat<t,p> toquat( tmat4x4<t,p> const &x )
within these list of functions; there functions allow rotate using quaternion using 2 vectors returns quaternion, convert , matrix3x3 or 4x4 , other useful functions.
Comments
Post a Comment