
[Math] optimize Vector transform by Quaternion
Posted Thursday, 12 November, 2009 - 15:57 by kvark| Project: | The Open Toolkit library |
| Version: | 1.0-beta-2 |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
The regular transform equation:
Q * V * inv(Q)
Can be optimized by taking in account the property of V.w = 0 (it's a quaternion created from a vector).
The optimized GLSL version (first saw it in Lumina GLSL tutorials) that I'm using:
vec3 qrot(vec4 q, vec3 v) { return v + 2.0*cross(q.xyz, cross(q.xyz,v) + q.w*v); }


Comments
#1
Fixed in r2523.
#2
Closing issues fixed in 1.0 beta-2.