Rotation matrix ortho-normalization

This topic is 4833 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Quote:
Original post by MichaelT
Quote:
 Original post by Eelcogood luck using stawman tactics for everything.

explain: "stawman tactics"

i think he meant strawman arguments...

BTW, minorlogic: Privet, videl tvoi formuli kasatelno quaternionov na euclideanspace.com, kruto i vnushaet! (Hello, man! Readed your quaternion derivations on euclideanspace.com, pretty impressive!)

Share on other sites
Eelco as usual you misunderstood the question: This was the original question

“I'm trying to figure out how to orthonormalize a rotation matrix so that the basis vectors would be unit length and perpendicular. This is to combat floating point precision errors that accumulate in the matrix.”

For which Dmytry gave the correct answer.

I as understand this is the Game dev forum were people comes for answer to specific questions. You basically told Gaimplay that the answer to his question required a rewrite of the entire project for not reason at all. Has his done what you suggested in the end his still have the same problem his started with, would not he?
I just reconfirmed the first answer was the correct one for the question.
What you did was to create and answer in search of a new problem. Part of been smart is not just to accumulate knowledge you also need to understand then questions.
Has it occur to you hi may be working on a very serious project where engineering re-factoring is just not an option.

About the straw man argument: like I said as usual you missing the point again and changing the subject.

Dmytry I think I am or was in you side this question was not about quaternions was about matrices. Make no mistake, do not think you are the only one understanding the algebra of rotation many more people do to.

Share on other sites
Quote:
 Original post by Anonymous PosterEelco as usual you misunderstood the question: This was the original question“I'm trying to figure out how to orthonormalize a rotation matrix so that the basis vectors would be unit length and perpendicular. This is to combat floating point precision errors that accumulate in the matrix.”For which Dmytry gave the correct answer. I as understand this is the Game dev forum were people comes for answer to specific questions. You basically told Gaimplay that the answer to his question required a rewrite of the entire project for not reason at all. Has his done what you suggested in the end his still have the same problem his started with, would not he?I just reconfirmed the first answer was the correct one for the question.What you did was to create and answer in search of a new problem. Part of been smart is not just to accumulate knowledge you also need to understand then questions. Has it occur to you hi may be working on a very serious project where engineering re-factoring is just not an option.

i wasnt the one to bring up quaternions, i started out with giving him a possible solution to his stated problem. i merely confirmed what charles and dymtry suggested: quaternions might serve you better, so you might want to consider them. to which i added: probably, if you dont care for the advantages matrices have to offer over quats, which is likely in a gameengine.

Quote:
 About the straw man argument: like I said as usual you missing the point again and changing the subject.

believe whatever you wish. youll have to start making arguments though if youre interested in persuading others.

Quote:
 Dmytry I think I am or was in you side this question was not about quaternions was about matrices. Make no mistake, do not think you are the only one understanding the algebra of rotation many more people do to.

sure many people understand this, and my understanding probably isnt nearly as deep as that of a lot of others. i doubt those people include you though. i might add to that that dmytry and charlesB are the most knowledgeable people i know on these boards on the subject of math, and they seem to hold the same stance, which i will reiterate again for clarity: quaternions are the best method to store pure rotation (+ uniform scaling optionally).

were not forcing him to rewrite his engine using quats, we answered his question, dmytry corrected me and gave an even better method, and we gave some suggestions beyond the scope of his question: which he is free to act on or completely ignore.

Share on other sites
I've got a question about Dimitry's matrix orthonormalizing method.

This way the same columns are used. Is it a good idea to switch the order for which columns are processed for the orthonormalization during the simulation?

first with the order dimitry gave and next orthonormalisation

or is this just making things more complicated?

Share on other sites
1:Eelco gave keyword for search, therefore, he answered original question. I just failed to remember that it's named after Gramm-Schmidt, so i posted a solution.

After question is answered, it's OK to discuss related topics that can be useful for OP.

2:It's not needed to rewrite everything, because quaternions and rotation-only matrices represent same thing. They both is concatenated by multiplication, both should have functions like "load to openGL", most methods of both is the same. With good design, it's not a problem to replace one by other. Also, it's probably better if OP will rewrite it now than later, because probably the only thing he need to rewrite now is camera class.

3:I don't think no one else there understands rotations better than i. Yes, i sometimes have altitude like "f34r my math skillz", but it's usually when i'm first to reply with some simple calculations done in mind.

4: you gave no mathematical proofs, only some example quaternions that "should do bad things". In fact they don't, and it's pretty easy to mentally figure what 'em do if you know quaternions.

In summary: If you need to store and process variable rotation, quaternions is better than matrices.

f34r skillz part: today and at yesterday evening i worked with matrices for perspective transforms used to do that clickster (matrices that was used to make that hexagons, not camera matrices)

edit: and i must say, i clicked "reply" before i saw Eelco's reply.

[Edited by - Dmytry on October 26, 2004 9:26:21 AM]

Share on other sites
Quote:
 Original post by AiroI've got a question about Dimitry's matrix orthonormalizing method.This way the same columns are used. Is it a good idea to switch the order for which columns are processed for the orthonormalization during the simulation?first with the order dimitry gave and next orthonormalisationfor example start with Column3=Normalized(CrossProduct(Column1,Column2)) and do other 2 columnsor is this just making things more complicated?

It shouldn't matter -
Column1=Normalized(CrossProduct(Column2,Column3));
Column2=Normalized(CrossProduct(Column3,Column1));
needs to be normalized anyway.
Maybe my version is marginally more mathematically stable, but i can't say for sure.

It may be useful to swich order depending to what axis more needs to be keept mostly untouched.
It's may be better in some cases to keep specific row.
(it will work with rows instead of columsn as well). For instance, if matrix contains global->local transform for camera, iin opengl style, it's better to keep 3rd row.

Share on other sites
interesting picture.

what is it? a vonoroi representation of the vertices of a subdivided isocahedron?

Share on other sites
Quote:
 Original post by Eelcointeresting picture.what is it? a vonoroi representation of the vertices of a subdivided isocahedron?

Yes,kinda like that.
Some more things
I'm using some kind of projection matrices to get coordinates on icosohedron faces - i just multiply coordinate with 3x3 matrix and then divide result by result's z, and i'm getting point projected onto icosohedron face.

Share on other sites
sounds very interesting for planet rendering.

Share on other sites
You two are hopeless.

Quote:
“1:Eelco gave keyword for search, therefore, he answered original question. I just failed to remember that it's named after Gramm-Schmidt, so i posted a solution.”

I am glad he is learning that method I was the want who introduced to him after hi gave another erroneous answer to similar question in another tread. But I think he still needs to understand the meaning of it and not applying it literally.
And not he did not answer the question he just say quaternion are better than matrices.
And that is not truth. Maybe for him they are.

Quote:
“2:It's not needed to rewrite everything, because quaternions and rotation-only matrices represent same thing. They both is concatenated by multiplication, both should have functions like "load to openGL", most methods of both is the same. With good design, it's not a problem to replace one by other. Also, it's probably better if OP will rewrite it now than later, because probably the only thing he need to rewrite now is camera class.”

You are totally wrong man quaternion do not concatenate by multiplication, I just proved to you, just do it yourself, before making such statements, and yes replacing the transformation in a major re-factoring job that may bring a whole new bag of bugs. It may not even be possible, as I read the person is using directx.

Quote:
“3:I don't think no one else understands rotations better than i. Yes, i sometimes have altitude like "f34r my math skillz", but it's usually when i'm first to reply with some simple calculations done in mind.”

Wow that is a strong statement, the only think I can say is that it speaks for itself.
Oh maybe you should do more things on paper and less work in your mind, you could get better result, and less misleading would result of such impulsive reactions.

Quote:
“In summary: If you need to store and process variable rotation, quaternions is better than matrices”

perhaps you should rephrase it like this:

If you need to store and process variable rotation, in my opinion quaternions is better than matrices”

As for Eelco: I think there is not point to continue this argument: Eelco I think you should use quaternion in your projects and do not let anyone else to convince you otherwise.

Bye.

Share on other sites
Quote:
 Original post by Anonymous PosterYou two are hopeless.Quote:“1:Eelco gave keyword for search, therefore, he answered original question. I just failed to remember that it's named after Gramm-Schmidt, so i posted a solution.”I am glad he is learning that method I was the want who introduced to him after hi gave another erroneous answer to similar question in another tread. But I think he still needs to understand the meaning of it and not applying it literally.And not he did not answer the question he just say quaternion are better than matrices.And that is not truth. Maybe for him they are.

ah that explains a lot. i thought i recognized that debating style, or rather lack of it, from somewhere.

Quote:
 Quote:“2:It's not needed to rewrite everything, because quaternions and rotation-only matrices represent same thing. They both is concatenated by multiplication, both should have functions like "load to openGL", most methods of both is the same. With good design, it's not a problem to replace one by other. Also, it's probably better if OP will rewrite it now than later, because probably the only thing he need to rewrite now is camera class.”You are totally wrong man quaternion do not concatenate by multiplication, I just proved to you, just do it yourself, before making such statements, and yes replacing the transformation in a major re-factoring job that may bring a whole new bag of bugs. It may not even be possible, as I read the person is using directx.

why are directx and quaternions mutually exclusive? i dont know directx, so it might be for all i know, but it somehow seems very unlikely to me.

Quote:
 Quote:“3:I don't think no one else understands rotations better than i. Yes, i sometimes have altitude like "f34r my math skillz", but it's usually when i'm first to reply with some simple calculations done in mind.”Wow that is a strong statement, the only think I can say is that it speaks for itself.Oh maybe you should do more things on paper and less work in your mind, you could get better result, and less misleading would result of such impulsive reactions.Quote:“In summary: If you need to store and process variable rotation, quaternions is better than matrices”perhaps you should rephrase it like this:If you need to store and process variable rotation, in my opinion quaternions is better than matrices”As for Eelco: I think there is not point to continue this argument: Eelco I think you should use quaternion in your projects and do not let anyone else to convince you otherwise.Bye.

on the contrary. maybe this debate is pointless, and i fear it is, but if you would present some arguments as to why quaternions are not superior to matrices for the stated purposes, i would gladly consider them. unfortunatly, your ratio bewteen logical arguments and flames seems to be lowering by the post...

Share on other sites
AP don't you have an account. It's not so pleasant to speak with the invisible man.

Quote:
 Original post by Anonymous PosterRotation of a vector by a quaternion while it is possible it is about 8 time more expensive than rotation by the matrix equivalent.

False, it's of the same order of magnitude. I benchmark math functions all day long for my math lib. I remember a thread where I compared Q*V against M<-Q then M*V. The balance point was around 6 vertices. So you can easilly infer from these data, that Q*V is roughly 100%-50% slower than M*V. This depends on wether you use the FPU, 3DNow or SSE. Thus if you have less than 6 vertices. Quat*Vert is fine. Else with more verts the Quat to Matrix transfo, will be marginal.

Quote:
 If you do not belief me then you look and two mayor graphics apis OpenGL and direct3d they use matrices to form matrix stack, not quaternion.

You missed the point. It's first principally because matrices are not isomorph to quaternions. Matrices enable projections, non uniform scaling etc ... It's only for this reason : generality of the matrices that any RENDERER uses them in their API. It's also because the RENDERER obviously prefers to deal with matrices, the fastest way to transform many vertices, as you said it's the fastest general way.

BUT :

Obviously accumulation of rotations between frames concerns ANIMATION which is obviously of the user responsibility and the IN TOPIC for this thread. Quaternions are more accurate, because made of 4 floats. Implicitely a rotation and a uniform scaling. Exactly what's required, not less not more. That's for this precise reason that you could intuitively understand why it's far less sensible to numeric deviations than general matrices. Now if you want a true math proof Dmytry or I can surely deliver that. Still I have other cats to beat. But you could also possibly Google by yourself. That'd be fair. I also remember my first year in "Mathematiques Superieures", the teacher warned us very clearly that matrices are highly unstable numerically. So you could also ask to your local math teacher if you know one.

OpenGL and D3D do not cope with such accumulations. Well you could use the matrix stack this way but be prepared to see your scene shrink and post a noob question like : "Why does my scene disappear ?"

Share on other sites
Just a note.
In algorithm that i posted before, not used SQRT routine.

When you do cross and normalization , you use SQRT or invSQRT.

Share on other sites
Quote:
 Original post by Anonymous PosterYou two are hopeless.Quote:“1:Eelco gave keyword for search, therefore, he answered original question. I just failed to remember that it's named after Gramm-Schmidt, so i posted a solution.”I am glad he is learning that method I was the want who introduced to him after hi gave another erroneous answer to similar question in another tread.

Do you realize that it's not a valid argument?
Quote:
 But I think he still needs to understand the meaning of it and not applying it literally.And not he did not answer the question he just say quaternion are better than matrices.And that is not truth. Maybe for him they are. Quote:“2:It's not needed to rewrite everything, because quaternions and rotation-only matrices represent same thing. They both is concatenated by multiplication, both should have functions like "load to openGL", most methods of both is the same. With good design, it's not a problem to replace one by other. Also, it's probably better if OP will rewrite it now than later, because probably the only thing he need to rewrite now is camera class.”You are totally wrong man quaternion do not concatenate by multiplication, I just proved to you, just do it yourself, before making such statements,

Where you proved? Proved what?

or gamedev version

and mathworld, look at end of page.

Quaternion rotations is concatenated by quaternion multiplication.
Quote:
 and yes replacing the transformation in a major re-factoring job that may bring a whole new bag of bugs. It may not even be possible, as I read the person is using directx.

First time hear that quaternions is inpossible in directx.... interesting.
Quote:
 Quote:“3:I don't think no one else understands rotations better than i. Yes, i sometimes have altitude like "f34r my math skillz", but it's usually when i'm first to reply with some simple calculations done in mind.”Wow that is a strong statement, the only think I can say is that it speaks for itself.Oh maybe you should do more things on paper and less work in your mind, you could get better result, and less misleading would result of such impulsive reactions.

Maybe i have incorrectly computed angles and axises of your example quaternions?
Please catch at least one formal mistake i made in calculations before suggesting me what to do in paper.
Quote:
 Quote:“In summary: If you need to store and process variable rotation, quaternions is better than matrices”perhaps you should rephrase it like this:If you need to store and process variable rotation, in my opinion quaternions is better than matrices”As for Eelco: I think there is not point to continue this argument: Eelco I think you should use quaternion in your projects and do not let anyone else to convince you otherwise.Bye.

Bye.

[edit: quote tags fixed]

[Edited by - Dmytry on October 26, 2004 1:56:12 PM]

Share on other sites
Quote:
 Original post by minorlogicJust a note.In algorithm that i posted before, not used SQRT routine. When you do cross and normalization , you use SQRT or invSQRT.

Ya gde-to pro eto chital dage, vozmozhno tvoi tekst. Eto ti pridumal pervii? (moy quaternion-to-matrix prosto delaet mashtabiruuschuu matricu esli quaternion ne edinichnoi dlini). Mozhno novuu temu zapostit' , a-to tut opyat' anonimi vodu mutyat (delo konchitsya tem chto voobche zapretyat anonimov nafig). Eto osnovanno na idee chto esli podelit matricu na dlinu v kvadrate, poluchim pravilnuu matricu?

Yes, i readed about it somewhere. Maybe it was your text. It's interesting. It uses idea that if we scale resulting matrix by 1/squared_quaternion_length, we get matrix without scaling?

2everyone logged in: what you think about this quaternion from matrix and quaternion to matrix formules? Is it's known?

Share on other sites
Hi Dmytry.

quat 2 matrix formula -> is derived from Quaternion properties.
we just use nonunit quat to derive it.

matrix 2 qut is good known too, but produce nonunit quat and it is VERY efficient, such one i did not see anywhere.