TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Unlearn rotation matrices as rotations

258 pointsby dosshellalmost 5 years ago

23 comments

MiroFalmost 5 years ago
&quot;Don’t think of them as rotations, think of them as a unit vectors of a new coordinate systems.&quot;<p>This makes it clear to me that many people have been very poorly served by their linear algebra courses if that is not obvious.
评论 #24051123 未加载
评论 #24051416 未加载
评论 #24053395 未加载
评论 #24057955 未加载
评论 #24052854 未加载
评论 #24055713 未加载
评论 #24057072 未加载
评论 #24056617 未加载
评论 #24053217 未加载
评论 #24052637 未加载
activatedgeekalmost 5 years ago
&gt; Rotation matrices just describe the unit vectors of a new coordinate system<p>More generally, _every_ matrix describes <i>how</i> a change of coordinate system should happen. For any m x n (m rows, n columns) matrix, each of the the n column vectors represent how the current coordinate system (which may or may not be unit vectors) should be represented in the new coordinate system (for a left multiplied matrix).<p>Whenever a matrix&#x27;s determinant is zero, it means that you squashed some dimensions. As you can imagine, when m is not equal to n, there will always be dimension squashing. Even when they are equal, that can happen. If you take a 3 x 3 matrix and it transforms <i>all</i> the 3-D vectors into only planes (which are 2-D objects), the determinant will be zero. This would be stated as having a rank of 2. More simply, you&#x27;d say the &quot;volume&quot; of the transform to be 0 (because planes have zero volume).<p>EDIT: Make sure to read important clarifications by JadeNB below.
评论 #24052127 未加载
mdtuszalmost 5 years ago
&gt; The first column of the rotation matrix is the new x-axis expressed in the old coordinate system, the second column is the y-axis and so on. An identity matrix would yield in no rotation since all unit vectors would be the same as the previous coordinate system.<p>It&#x27;s a shame that this isn&#x27;t made more clear in most tutorials and classes. The idea of axis application order really does make things more confusing than is needed.
评论 #24050421 未加载
评论 #24049954 未加载
jpeloquinalmost 5 years ago
If we relax the restriction that the columns of the 3x3 transformation matrix must be unit vectors, we also get the ability to apply scaling and shear transformations. In solid mechanics, this is called the F tensor, and is used to describe deformation of materials [1].<p>There is also an augmented 4x4 form if translation is needed as well:<p><pre><code> | Q ... Δx | | vx | | . Δy | | vy | | . Δz | dot | vz | = new vector | 0 0 0 1 | | 1 | </code></pre> where &quot;Q&quot; is the 3 × 3 transformation matrix (e.g., rotation matrix) that is the subject of the OP, and [vx, vy, vz, 1] is the augmented form of a vector &quot;v&quot; = [vx, vy, vz] that is being transformed.<p>The augmented form is especially useful for transforming voxel indices in an 3D image array to spatial coordinates, such as for MRI or CT image data [2]. It is helpful if the index coordinate system has its origin at zero (zero-indexed arrays), like a normal coordinate system.<p>Finally, if we have many [x, y, z, 1] data points that each have an old and a new position, we can compute the overall best-fit transformation from the old to new positions with the least-squares solution to<p><pre><code> A x = b </code></pre> where &quot;A&quot; is the (unknown) augmented matrix representing the transformation, &quot;x&quot; is a 4 × n array storing the points&#x27; old augmented-form positions, and &quot;b&quot; is a 4 × n array storing the points&#x27; new augmented-form positions. If we allow the points to have arbitrary dimension, without any particular spatial interpretation, we get least squares curve fitting and the foundation of machine learning.<p>[1] <a href="http:&#x2F;&#x2F;homepages.engineering.auckland.ac.nz&#x2F;~pkel015&#x2F;SolidMechanicsBooks&#x2F;Part_III&#x2F;Chapter_2_Kinematics&#x2F;Kinematics_of_CM_02_Deformation_Strain.pdf" rel="nofollow">http:&#x2F;&#x2F;homepages.engineering.auckland.ac.nz&#x2F;~pkel015&#x2F;SolidMe...</a><p>[2] <a href="https:&#x2F;&#x2F;nifti.nimh.nih.gov&#x2F;nifti-1&#x2F;documentation&#x2F;nifti1fields&#x2F;nifti1fields_pages&#x2F;qsform.html" rel="nofollow">https:&#x2F;&#x2F;nifti.nimh.nih.gov&#x2F;nifti-1&#x2F;documentation&#x2F;nifti1field...</a>
评论 #24058063 未加载
dazzawazzaalmost 5 years ago
I was eight years in to professional videogame dev. When I decided to debug matrices used to generate racing track surfaces by drawing the columns in the game world when I realised they were X&#x2F;Y&#x2F;Z axis. I felt so stupid. I jokingly told the other coders around me how stupid I was... turns out we were all stupid.<p>One old timer laughed in the background and told us how he discovered this on the Amiga a few years before.
viveksethalmost 5 years ago
I learned this concept by watching 3blue1brown&#x27;s series on Linear Algebra: <a href="https:&#x2F;&#x2F;www.3blue1brown.com&#x2F;essence-of-linear-algebra-page" rel="nofollow">https:&#x2F;&#x2F;www.3blue1brown.com&#x2F;essence-of-linear-algebra-page</a><p>Would highly recommend. I feel like Grant&#x27;s videos gave me a better understanding of Linear Algebra than the course I took in college.
评论 #24052466 未加载
评论 #24051136 未加载
评论 #24050709 未加载
评论 #24051048 未加载
评论 #24053988 未加载
beefieldalmost 5 years ago
Funny. Only some months ago I needed to figure out how to represent unit vectors of (a rotated) coordinate system in another coordinate system. After some days of drawing on the paper I came to the conclusion that actually the rotation vector columns are just that. But found no way to verify that claim in the internet. Thank you for this.
评论 #24050108 未加载
评论 #24050682 未加载
smlckzalmost 5 years ago
I remember asking in freenode irc channel ##math that why matrix multiplication is defined like that, why not in any other way. I was told that:<p>&gt;&gt; cuz the composition of linear maps are defined like that.<p>It took a long time to understand what they meant. Still I see how it is taught to work out mechanically. Brave friends of mine went to the Wikipedia page to come back with more confusion. Wikipedia is a great reference when you know the subject well enough.<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Wikipedia:WikiProject_Mathematics&#x2F;Advice_on_using_Wikipedia_for_mathematics_self-study" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Wikipedia:WikiProject_Mathemat...</a>
评论 #24052142 未加载
adenadelalmost 5 years ago
I want to share my favorite linear algebra textbook (Linear Algebra Done Right by Axler)<p><a href="http:&#x2F;&#x2F;linear.axler.net&#x2F;" rel="nofollow">http:&#x2F;&#x2F;linear.axler.net&#x2F;</a><p>It&#x27;s meant for a second course in linear algebra and the focus is on abstract vector spaces and linear transformations (rather than a table of numbers perspective). It also doesn&#x27;t use determinants until the last chapter.
评论 #24061188 未加载
undershirtalmost 5 years ago
It’s clearer in 2D. Rotating by angle `a` tilts the x-axis to (cos(a), sin(a)), because that’s the very definition of cosine and sine (i.e. the x and y components of angles on the unit circle). The y-axis just flips the components and negates one, because that’s what 90° rotations do.
a_zaydakalmost 5 years ago
This is so important! I spend my life writing EKFs for navigation systems however did not have a good linear algebra education. It was a hard struggle! Now, every time I have a new hire or intern, the first thing that I go over is basic linear algebra and rotations including DCM, Euler angles, quaternions, and so on. I also make sure they understand it graphically such as how you can scale and project vectors using a matrix.
评论 #24056217 未加载
bawanaalmost 5 years ago
I thought I knew what rotation matrices were until I read this article. Now I am confused. I used to think I needed a 3x3 matrix to rotate a point (with x,y,z coordinates) in 3 D space. But the article refers to Rx,Ry and Rz EACH of which are a 3x3 matrix.Why are there 3 matrices? To move an x coordinate to a new coordinate system, I only need to displace it among the the existing three axes. So each coordinate only needs a 3x1 vector to displace it . That a makes a single 3x3 matrix.
评论 #24050584 未加载
评论 #24050231 未加载
评论 #24050214 未加载
评论 #24052046 未加载
评论 #24050184 未加载
评论 #24050220 未加载
评论 #24050154 未加载
failuseralmost 5 years ago
I&#x27;d say quatenions are a nicer way to represent rotations, but 4x4 matrix can describe any projective transformation in 3d.
FabHKalmost 5 years ago
Two remarks:<p>1. &gt; Right handed, z forward through the nose and x through the left ear.<p>Interesting, in aviation engineering the convention is different: the body frame has x forward (positive rotation around x is right roll), y to the right (... pitch up), z down (... right yaw).<p>2. The best reference (reference, not explanation&#x2F;textbook) for this whole spiel (rotation matrices, Euler angles, quaternions) I&#x27;ve seen is a paper by Diebel, <i>Representing attitude: Euler angles, unit quaternions, and rotation vectors</i><p><a href="https:&#x2F;&#x2F;www.astro.rug.nl&#x2F;software&#x2F;kapteyn-beta&#x2F;_downloads&#x2F;attitude.pdf" rel="nofollow">https:&#x2F;&#x2F;www.astro.rug.nl&#x2F;software&#x2F;kapteyn-beta&#x2F;_downloads&#x2F;at...</a><p>(Or maybe I like it because &quot;Diebels Alt&quot; is my favourite local beer... <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Altbier" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Altbier</a>)
uzbitalmost 5 years ago
Speaking of unlearning rotations, has anyone looked at <a href="https:&#x2F;&#x2F;bivector.net" rel="nofollow">https:&#x2F;&#x2F;bivector.net</a> ? Some other hacker posted it a while back on another thread and I found it to be really intriguing.
IshKebabalmost 5 years ago
This is a great clarification. It&#x27;s a shame that Wikipedia is such a bad reference for learning maths. I think it is a result of most maths articles being edited by people who just learnt something and therefore don&#x27;t understand it enough to explain it well, and also want to show off their knowledge rather than actually explain things.<p>Mathworld is much much better in general.<p>(Somebody&#x27;s probably going to reply &quot;Wikipedia is an encyclopaedia not a tutorial&quot;.)
评论 #24050459 未加载
评论 #24050683 未加载
评论 #24051253 未加载
评论 #24050341 未加载
jherikoalmost 5 years ago
i have also encountered this problem. i learned the nature of rotation from first principles in order to solve these problems without documentation... which has turned out to be a massive boon.<p>tutorials are the devil. they do not teach so much as demonstrate a lot of the time.<p>its a sad place to be
rory_h_ralmost 5 years ago
There&#x27;s nothing wrong with understanding rotation matrices as rotations, it&#x27;s just that in their application it&#x27;s not the right mental model. Ideally you&#x27;ll understand both representations and switch between them as needed.
saeranvalmost 5 years ago
The way I think about it: any matrix multiplication consists of the linear combination of the column vectors of your transformation matrix, with each column vector &#x27;weighted&#x27; by the the input vector&#x27;s x, y, z, ... n values.
syntaxingalmost 5 years ago
I think the biggest struggle with rotation matrix isn&#x27;t the theory but the nomenclature. Is it R(ZYX)?! Is it rotation axis rather than Euler angles?! All the convention differences can make signficant mistake very quickly.
dmch-1almost 5 years ago
For some time I was surprised that anyone would represent rotations by anything else but rotation matrices. I sometimes do find wikipedia useful for quick answers for maths, however agree its quite disorganised.
seventytwoalmost 5 years ago
Is there a good web app where you can play around in a visual 3D space with transforms like this and other ones like quaternions?
评论 #24096592 未加载
layoutIfNeededalmost 5 years ago
I’ve encountered this misunderstanding many times, usually in the context of creating a rotation matrix for a given direction and “up” vector. People look baffled when I replace their elaborate Euler-rotation algorithm with three lines of code:<p><pre><code> z = direction x = up.cross(z).normalized() y = z.cross(x) M = [x, y, z]</code></pre>
评论 #24051216 未加载