DGL
https://delphigl.com/forum/

Matrix - Getting angles
https://delphigl.com/forum/viewtopic.php?f=19&t=3983
Seite 1 von 1

Autor:  Stucuk [ Di Mär 29, 2005 23:42 ]
Betreff des Beitrags:  Matrix - Getting angles

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"

Autor:  Flash [ Mi Mär 30, 2005 00:42 ]
Betreff des Beitrags: 

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).

Autor:  Stucuk [ Mi Mär 30, 2005 01:18 ]
Betreff des Beitrags: 

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

Autor:  Flash [ Mi Mär 30, 2005 13:16 ]
Betreff des Beitrags: 

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 ;) )

Autor:  Stucuk [ Mi Mär 30, 2005 15:36 ]
Betreff des Beitrags: 

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)

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/