| 203 | } |
| 204 | |
| 205 | void stVec2QtUpdate(Quaternion &p, Quaternion &q, const TVec3f &dir, const TVec3f &vec) |
| 206 | { |
| 207 | TVec3f crossp; |
| 208 | crossp.cross(dir, vec); |
| 209 | |
| 210 | float length = stspeedy_sqrtf(2.0f * (1.0f + dir.dot(vec))); |
| 211 | if (length > 0.0f) |
| 212 | { |
| 213 | Quaternion a; |
| 214 | a.x = crossp.x / length; |
| 215 | a.y = crossp.y / length; |
| 216 | a.z = crossp.z / length; |
| 217 | a.w = (0.5f * length); |
| 218 | |
| 219 | Quaternion c; |
| 220 | stQtMult(&c, &a, &p); |
| 221 | stQtNormalize(&q, &c); |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | void stVec2QtUpdate(Quaternion &q, const Vec &dir, const Vec &vec) |
| 226 | { |
no test coverage detected