kvark's picture

[Math] optimize Vector transform by Quaternion

Project:The Open Toolkit library
Version:1.0-beta-2
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:closed
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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

#1

Version:all versions» 0.9.x-dev
Status:open» fixed

Fixed in r2523.

the Fiddler's picture

#2

Version:0.9.x-dev» 1.0-beta-2
Status:fixed» closed

Closing issues fixed in 1.0 beta-2.