Im wondering if anyone knows of any source on getting the angles from a matrix. I know there is one in GeometryEx.pas but its never worked right for me.
I need it so i can restrict a Rotating door, so it doesn't rotate into the "world"
Registriert: Do Sep 25, 2003 15:56 Beiträge: 7804 Wohnort: Sachsen - ERZ / C
Programmiersprache: Java (, Pascal)
I am not sure, but I think any answer to this question has precisionproblems. You need the sin^-1 and cos^-1 of the values in the upper left part of the matrix.
You surely know how the worldmatrix is build (what komponent means what). So you can try to solve it your self, but I thin you get in trouple because floatingpoint operations are not that precise (they sure will fluctuate).
_________________ Blog: kevin-fleischer.de und fbaingermany.com
I was good at maths at school. But in the wide world my maths is crap. I know how to apply a matrix to a poitnt to work out the new point, but thats pritty much it. I don't know the maths behind adding an angle to a matrix, let alone "undoing" it.
How precise it is doesn't matter as long as the error margine is 1 degree or less eather side. (since its a restriction, 1 degree over the actual restriction won't matter)
Edit: Its Geometry.pas and it seems to go from -90 to 90, which isn't good since u realry need 0 - 360/-180 - 180
Registriert: Do Sep 25, 2003 15:56 Beiträge: 7804 Wohnort: Sachsen - ERZ / C
Programmiersprache: Java (, Pascal)
When you get an OpenGLmatrix its components represent this:
the upper left 3x3 matrix stores the rotation and scaling. The first 3 values in the 4th column represent the translations.
The first 3 values in the 4th line represent the perspektive. And the last value (bottom right) is a scalingfactor over all.
The problem is, that your rotation is mixed with the scaling.
Look in this script. Sadly for you its in german. But you can find how to build a rotationmatrix on page 9. What part of a matrix means what, you can find on page 19. (use dict.tu-chemnitz.de if you whant to translate some words )
_________________ Blog: kevin-fleischer.de und fbaingermany.com
hmm, think iv thought of a simpler answer. Work out how much the center of the door(worked out by applying the matrix to the max and min and working out the cneter) is around the origin of the door. (which is the point where the door rotates at)
Lovley Q2 To Delphi has a procedure to do this. (the one where it works out what angle the camera should face so u see the enemy that killed u)
Mitglieder in diesem Forum: 0 Mitglieder und 5 Gäste
Du darfst keine neuen Themen in diesem Forum erstellen. Du darfst keine Antworten zu Themen in diesem Forum erstellen. Du darfst deine Beiträge in diesem Forum nicht ändern. Du darfst deine Beiträge in diesem Forum nicht löschen. Du darfst keine Dateianhänge in diesem Forum erstellen.