Re:How to Fix Gimbal Lock in N-Dimensions
by peter_d_sherman on Saturday August 29, 2020 @03:07PM
(#24318641)
>"Generalizing to N-dimensions
To generalize this solution to higher dimensions we need two things:
A way to represent rotations. So far in 3D we’ve used 3x3 matrices and quaternions.
A way to describe a rotation around an arbitrary axis.
Side note: it’s more generalizable to talk about “rotating within a plane” instead of “rotating around an axis”. In 2D there is only one plane of rotation, the XY plane. In 3D there are 3 planes of rotation. In 4D there are 6 planes. In N-D there are (N choose 2) planes.
I ended up choosing 4x4 matrices to represent my rotations, because 4x4 matrix operations are supported on the GPU and so I could rotate the geometry in my vertex shader, in the same way I would in 3D."
PDS: I was reading this, and something clicked -- if we think about it, a Matrix (in mathematics) is a 2D structure, that is, it has rows and columns, or a set of x/y (horizontal/vertical) axes, if you prefer.
Yet, we're using that 2D surface -- to represent higher-dimensional surfaces, 3D, 4D, [n]D etc.
So this is sort of like how we can go from 2D to [n]D.
But wait, it gets better!
We can also go from 2D (on the low end) down to 1D!
How would this be accomplished?
Well, while mathematicians (and most others!) would prefer the 2D representation of a matrix, that 2D matrix could also be represented in 1D (straight line), as a series of numbers, that is, you write down the numbers in the first row or column, then you write down the numbers in the second row or column, and you finish this process, much like the raster beam of old CRT TV's traced out an image on the screen!
So that gets us down to 1D, for the data of an [n]D surface.
But wait, things get even better!
That's because on the low-end, we could (although mathematicians and other normal people would despise the transformation!), we can also transform this 1D line/linear representation to 0D!
Now, just what in the heck is 0D, you might ask?
0D is TIME.
In other words (and again, no mathematician or normal person for that matter!) would want to do this, but you could take that line, that linear sequence of numbers (or whatever mathematical expressions comprises that sequence), and display them sequentially, one at a time, with a given time interval for each.
Sort of like a powerpoint presentation, where each number becomes one frame.
Or like a cartoon flip-book, where each frame is displayed for a certain small unit of time!
Of course, those things are still sort of 2D -- 0D would be more like an electrical pulse travelling down a wire, as a signal, during a unit of time, much like the information for a pixel, a given part of the screen would, in an old CRT tube where the electron beam reaches that part of the screen at a very specific point in TIME. Well, that signal, travelling through that one dimensional path, but only existing during a very brief unit of TIME -- that would be the 0D representation.
So knowing all of this then, we could then go from 0D -- to [n]D for any set of data.
Although most of us would be more comfortable with the staple 2D matrix notation that we all know and love from mathematics...
To generalize this solution to higher dimensions we need two things:
A way to represent rotations. So far in 3D we’ve used 3x3 matrices and quaternions.
A way to describe a rotation around an arbitrary axis.
Side note: it’s more generalizable to talk about “rotating within a plane” instead of “rotating around an axis”. In 2D there is only one plane of rotation, the XY plane. In 3D there are 3 planes of rotation. In 4D there are 6 planes. In N-D there are (N choose 2) planes.
I ended up choosing 4x4 matrices to represent my rotations, because 4x4 matrix operations are supported on the GPU and so I could rotate the geometry in my vertex shader, in the same way I would in 3D."
PDS: I was reading this, and something clicked -- if we think about it, a Matrix (in mathematics) is a 2D structure, that is, it has rows and columns, or a set of x/y (horizontal/vertical) axes, if you prefer.
Yet, we're using that 2D surface -- to represent higher-dimensional surfaces, 3D, 4D, [n]D etc.
So this is sort of like how we can go from 2D to [n]D.
But wait, it gets better!
We can also go from 2D (on the low end) down to 1D!
How would this be accomplished?
Well, while mathematicians (and most others!) would prefer the 2D representation of a matrix, that 2D matrix could also be represented in 1D (straight line), as a series of numbers, that is, you write down the numbers in the first row or column, then you write down the numbers in the second row or column, and you finish this process, much like the raster beam of old CRT TV's traced out an image on the screen!
So that gets us down to 1D, for the data of an [n]D surface.
But wait, things get even better!
That's because on the low-end, we could (although mathematicians and other normal people would despise the transformation!), we can also transform this 1D line/linear representation to 0D!
Now, just what in the heck is 0D, you might ask?
0D is TIME.
In other words (and again, no mathematician or normal person for that matter!) would want to do this, but you could take that line, that linear sequence of numbers (or whatever mathematical expressions comprises that sequence), and display them sequentially, one at a time, with a given time interval for each.
Sort of like a powerpoint presentation, where each number becomes one frame.
Or like a cartoon flip-book, where each frame is displayed for a certain small unit of time!
Of course, those things are still sort of 2D -- 0D would be more like an electrical pulse travelling down a wire, as a signal, during a unit of time, much like the information for a pixel, a given part of the screen would, in an old CRT tube where the electron beam reaches that part of the screen at a very specific point in TIME. Well, that signal, travelling through that one dimensional path, but only existing during a very brief unit of TIME -- that would be the 0D representation.
So knowing all of this then, we could then go from 0D -- to [n]D for any set of data.
Although most of us would be more comfortable with the staple 2D matrix notation that we all know and love from mathematics...