the Fiddler's picture

Vector[234] contains C# 3.0 code

Project:The Open Toolkit library
Category:bug report

Issue reported here:

Quaternion v = new Quaternion() { X = vec.X, Y = vec.Y, Z = 0, W = 0 };
; expected (CS1002) - C:\svn\opentk\Source\OpenTK\Math\Vector2.cs:911,82


Comment viewing options

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


Version:1.0-beta-1» 0.9.x-dev
Status:open» fixed

Fixed in rev. 2505.

kvark's picture


wow, you're fast :)

kvark's picture


Status:fixed» open

hmmm... I already have rev 2505 and it's definitely not fixed there...

the Fiddler's picture


I just realized I forgot to mention that this fix went to the 1.0 branch. You need to pull from:

kvark's picture


hm... you implemented the multiplication in a different order then me.
Your way:
inv(q) * v * q
My way:
q * v * inv(q)

I guess it's just a matter of convention.
But still, as far as I see (, you took non-standard approach.
Maybe it should be the other way?

BTW, is 0.9,x-dev is planned to be frozen or the quaternions fix will eventually appear there?

the Fiddler's picture


Status:open» fixed

I think there's a logical explanation behind this but I can't remember what (It's too late in the night for me to derive the math right now...) The important thing is that it works (try it!)

0.9.x-dev tracks the 1.0 branch (e.g. 1.0 beta-1 has a version number of 0.9.4). 1.x-dev tracks the trunk. I have backported the fix to both branches now.

kvark's picture


Thanks for the backporting.

About the Q * V implementation:
I can't use it, because it behaves like Q is inversed for my case.
Please, make sure the convention you choose matches the one most of people use.
(Already scanned 3 links, all pointing to the way I need).

Moreover, I expected the implementation not to be straightforward (Q*V*inv(Q)), but use the knowledge of V.w = 0.
In GLSL my transform function looks like this:

vec3 qrot(vec4 q, vec3 v)	{
	return v + 2.0*cross(, cross(,v) + q.w*v);

I guess it's faster than straighforward way.

the Fiddler's picture


I know I'm annoying, but please open new bug reports for these issues (inverted Q and optimization). :)

Annoying as this may be, it really helps keep track of what needs to be done and when.

kvark's picture


You are not annoying.
It's my fault not opening the issues initially.

the Fiddler's picture


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

Closing issues fixed in 1.0 beta-2.