This I want to improve and made suggestions in the papercut forum section.
I think for getYaw(), getPitch() and getRoll() it's important to know the co-domain of the returned values.
Especially the result of getYaw() can confuse people. (In the past I had problems, because of the lack of documentation. Today I read that also somebody else has problems related to getYaw().)
A half year ago I published the co-domains which I detected by a tiny test application.
User Kojack disagreed and said the co-domain of getYaw would be -180 to 180 degree.getYaw -90 .. 90
getPitch -180 .. 180
getRoll -180 .. 180
Until today there is no consistency (of our both opinions) and thus there is not any documentation.
I want to fill this lack of documentation, but for this I need the state of the art.
I will be happy about every reply.
Here is the discussion of the papercut topic.
I want to continue the discussion here in the public/common Ogre forum to have a larger audience. (The papercut topic has fallen asleep.)
Beauty wrote:Related to Ogre::Quaternion::getYaw()
By some tests I found out that the co-domain of the returned value of getYaw() is from -90° to 90°.
This should be mentioned in the method description, because some people could suppose the returned value has a co-domain of -180°..180° or 0°..360°.
So the co-domain note would be a useful hint for people who doesn't know.
Proposed addition for the description of getYaw():My personal background:The co-domain of the returned value is from -90 to 90 degrees.
In maritime navigation it usual to use a 360° co-domain for Yaw. So I was confused because of wrong calculation values, until I recognized that getYaw() returns only a 180° co-domain.
Also the co-domain for the other getAngle methods should be documentated:
Ogre::Quaternion::getPitch()
-180°..180°
Ogre::Quaternion::getRoll()
-180°..180°
Kojack wrote:getYaw() is -180 to 180. I just tested it and it returned values below -90 and above 90 fine.
Beauty wrote:I wrote a nested loop which creates a SceneNode and set its Orientation (quaternion) to several rotation states.Kojack wrote:getYaw() is -180 to 180. I just tested it and it returned values below -90 and above 90 fine.
For each state it reads the yaw/pitch/roll values.
As results it shows the minimum and maximum values, that were returned by yaw/pitch/roll.
This is the investigated co-domain.
Source code of my test, witten in C#:Result:Code: Select all
Single yaw = 0; Single pitch = 0; Single roll = 0; Single ymin = 0; Single ymax = 0; Single pmin = 0; Single pmax = 0; Single rmin = 0; Single rmax = 0; Single y, p, r; Quaternion quat = new Quaternion(new Degree(yaw), Vector3.UNIT_Y); SceneNode node = new SceneNode(Smgr); Console.WriteLine("Start calculation ...\n"); Console.Write("Intermediate steps: "); for (yaw = -200; yaw <= 400; yaw++) { for (pitch = -200; pitch <= 200; pitch++) { for (roll = -200; roll <= 200; roll++) { node.Orientation = new Quaternion(new Degree(yaw), Vector3.UNIT_Y); node.Pitch(new Degree(pitch), Node.TransformSpace.TS_LOCAL); node.Roll(new Degree(roll), Node.TransformSpace.TS_LOCAL); quat = node.Orientation; y = quat.Yaw.ValueDegrees; p = quat.Pitch.ValueDegrees; r = quat.Roll.ValueDegrees; if (y < ymin) ymin = y; if (y > ymax) ymax = y; if (p < pmin) pmin = p; if (p > pmax) pmax = p; if (r < rmin) rmin = r; if (r > rmax) rmax = r; } } Console.Write("."); if ((yaw % 10) == 0) Console.Write(yaw); // show current state of calculation } Console.WriteLine("\n\nCalculation ready.\n"); Console.Write("co-domains:\n"); Console.Write(String.Format("Yaw {0} .. {1} \n", ymin, ymax)); Console.Write(String.Format("Pitch {0} .. {1} \n", pmin, pmax)); Console.Write(String.Format("Roll {0} .. {1} \n", rmin, rmax));Yaw -90 .. 90
Pitch -180 .. 180
Roll -180 .. 180No case of my test loop returned a Yaw value below -90 or above 90 degree.Kojack wrote:getYaw() is -180 to 180. I just tested it and it returned values below -90 and above 90 fine.
Or is there a mistake in my test loop?
Beauty wrote:I made some more experiments with my test loop.
So I found a nice example case:
When I set the orientation of a SceneNode to yaw = 120 degree by
node.Orientation = new Quaternion(new Degree(120), Vector3.UNIT_Y);
and read the orientation values, then I get this result:
Yaw = 60
Pitch = 180
Roll = 180
