TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Quaternions

377 点作者 the_origami_fox超过 3 年前

29 条评论

dhosek超过 3 年前
I first encountered quaternions in the concept of abstract algebra. It&#x27;s interesting to think of it as part of a spectrum starting with reals and continuing to octonions (and beyond). Interestingly with each extension we lose something:<p>Complex numbers (2-dimensional): No more ordering<p>Quaternions (4-dimensional): No more commutative multiplication<p>Octonions (8-dimensional): No more associative multiplication<p>Sedenions (16-dimensional): We lose the alternative property, i.e., with octonions its still true that <i>x</i>(<i>xy</i>) = (<i>xx</i>)<i>y</i> but with sedenions it is not.<p>We can continue this process indefinitely, although I know nothing of the characteristics of trigintaduonions or what comes later. I suspect that it might be the loss of the flexible identity next, <i>a</i>(<i>ba</i>) = (<i>ab</i>)<i>a</i> but I don&#x27;t know for sure.
评论 #29513533 未加载
评论 #29514411 未加载
评论 #29513765 未加载
评论 #29514464 未加载
评论 #29518050 未加载
评论 #29519157 未加载
评论 #29514861 未加载
trylfthsk超过 3 年前
W.R Hamilton&#x27;s discovery of the Quaternions is semi-famous itself, with the story being that after the critical flash of insight he carved the equation describing quaternion multiplication into a bridge in Ireland with a penknife.<p>A interesting read is this letter [0] written the following day, where he explains his ideas in his own words. It&#x27;s a great (and accessible!) look into his thought process.<p>[0] <a href="https:&#x2F;&#x2F;www.maths.tcd.ie&#x2F;pub&#x2F;HistMath&#x2F;People&#x2F;Hamilton&#x2F;QLetter&#x2F;QLetter.pdf" rel="nofollow">https:&#x2F;&#x2F;www.maths.tcd.ie&#x2F;pub&#x2F;HistMath&#x2F;People&#x2F;Hamilton&#x2F;QLette...</a>
评论 #29512660 未加载
Const-me超过 3 年前
One interesting thing about quaternions that’s almost never mentioned anywhere on the internets, there’re two conventions for them.<p>The convention in that article is known as “Hamilton&#x27;s quaternions”. There’s another incompatible one usually called “JPL quaternions”, for some American Jet Propulsion Laboratory.<p>Authors of 99% articles about the quaternions, and software libraries implementing quaternions, are assuming exactly one of these conventions, and almost never mention which one that is.<p>More info there: <a href="https:&#x2F;&#x2F;fzheng.me&#x2F;2017&#x2F;11&#x2F;12&#x2F;quaternion_conventions_en&#x2F;" rel="nofollow">https:&#x2F;&#x2F;fzheng.me&#x2F;2017&#x2F;11&#x2F;12&#x2F;quaternion_conventions_en&#x2F;</a>
评论 #29515386 未加载
评论 #29515027 未加载
评论 #29514891 未加载
newpavlov超过 3 年前
In my opinion, Geometric Algebra and bivectors (<a href="https:&#x2F;&#x2F;bivector.net" rel="nofollow">https:&#x2F;&#x2F;bivector.net</a>) in particular is a much better (both practically and pedagogically) approach compared to quaternions and significantly more elegant. It&#x27;s a real shame that people continue to focus so much on quaternions in this day and age.
评论 #29516191 未加载
评论 #29512252 未加载
评论 #29513267 未加载
评论 #29513176 未加载
评论 #29513973 未加载
评论 #29516094 未加载
评论 #29514047 未加载
steve_adams_86超过 3 年前
I remember the first time I encountered quaternions, and it was in a similar context. I was using PiQT 3d to move models in a simulation.<p>At first it really bothered me that quaternions were a black box to me, yet so easy to use in so many contexts. What kind of magic was happening? I had to know.<p>My math is terrible. I spent actual days revisiting YouTube videos explaining quaternions but my limited brain cells were failing to properly grasp it. I had to know though, I’d go crazy writing so much code that depends on something I couldn’t understand.<p>It took a long time. This would have been very helpful. Quaternions are very cool, and well worth reading about if you do anything in the digital 3d world.<p>I think I can still hear my brain sizzling as I tried to absorb this stuff.
评论 #29513506 未加载
Jun8超过 3 年前
3B1B is also informative, especially in explaining why C was not extended using triplets but 4-tuples were needed: <a href="https:&#x2F;&#x2F;youtu.be&#x2F;d4EgbgTm0Bg" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;d4EgbgTm0Bg</a>.<p>Here’s a Math SE answer on why: <a href="https:&#x2F;&#x2F;math.stackexchange.com&#x2F;questions&#x2F;1784166&#x2F;why-are-there-no-triernions-3-dimensional-analogue-of-complex-numbers-quate&#x2F;1784171" rel="nofollow">https:&#x2F;&#x2F;math.stackexchange.com&#x2F;questions&#x2F;1784166&#x2F;why-are-the...</a>, here’s a more ELI5 discussion: <a href="https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;math&#x2F;comments&#x2F;9urjyx&#x2F;why_there_is_no_complex_numbers_in_3_dimension&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;math&#x2F;comments&#x2F;9urjyx&#x2F;why_there_is_n...</a>. I especially like this very intuitive comment in that thread : <a href="https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;math&#x2F;comments&#x2F;9urjyx&#x2F;comment&#x2F;e96j4lg&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;math&#x2F;comments&#x2F;9urjyx&#x2F;comment&#x2F;e96j4l...</a><p>Left as an exercise to reader: prove that no such n-tuples exist for n&gt;4.
评论 #29511453 未加载
评论 #29511270 未加载
评论 #29511221 未加载
ivanstojic超过 3 年前
Interesting thing to remember: quaternions are a special application of rotors, a concept which may be easier to understand as a base:<p><a href="https:&#x2F;&#x2F;marctenbosch.com&#x2F;quaternions&#x2F;" rel="nofollow">https:&#x2F;&#x2F;marctenbosch.com&#x2F;quaternions&#x2F;</a>
an1sotropy超过 3 年前
David Eberly has written a huge amount of great and free intro mathematical papers. The &quot;Mathematics&#x2F;Algebra&quot; section of [1] has a few things on quaternions, including a nice self-contained linear algebra-based derivation of why it makes sense to represent a rotation with four numbers, which ends up being a sneaky introduction to quaternions [2]<p>[1] <a href="https:&#x2F;&#x2F;www.geometrictools.com&#x2F;Documentation&#x2F;Documentation.html" rel="nofollow">https:&#x2F;&#x2F;www.geometrictools.com&#x2F;Documentation&#x2F;Documentation.h...</a><p>[2] <a href="https:&#x2F;&#x2F;www.geometrictools.com&#x2F;Documentation&#x2F;LinearAlgebraicQuaternions.pdf" rel="nofollow">https:&#x2F;&#x2F;www.geometrictools.com&#x2F;Documentation&#x2F;LinearAlgebraic...</a>
pixelpoet超过 3 年前
Smallest of small notes: in TeX, &quot;cos&quot; is rendered as a product of 3 italicised variables c, o and s, whereas the escaped literal &quot;\cos&quot; is rendered as the cosine function.
评论 #29512348 未加载
jodrellblank超过 3 年前
&gt; although a lecturer once eluded to them during a class in my masters<p>Would be more amusing if &quot;they eluded a lecturer&quot; or &quot;a lecturer once elided them&quot;.<p>(&quot;alluded to them&quot;).
评论 #29511421 未加载
adamnemecek超过 3 年前
You should check out the bivector community dedicated to geometric algebra <a href="https:&#x2F;&#x2F;bivector.net&#x2F;" rel="nofollow">https:&#x2F;&#x2F;bivector.net&#x2F;</a>.<p>Check out a demo <a href="https:&#x2F;&#x2F;observablehq.com&#x2F;@enkimute&#x2F;animated-orbits" rel="nofollow">https:&#x2F;&#x2F;observablehq.com&#x2F;@enkimute&#x2F;animated-orbits</a><p>Join the discord <a href="https:&#x2F;&#x2F;discord.gg&#x2F;vGY6pPk" rel="nofollow">https:&#x2F;&#x2F;discord.gg&#x2F;vGY6pPk</a>.<p>Enki (the guy behind bivector) also gave a talk on GA at SIGGRAPH 2019 <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=tX4H_ctggYo" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=tX4H_ctggYo</a>
dr_orpheus超过 3 年前
&gt; I did not encounter quaternions in all my years of engineering, although a lecturer once alluded to them during a class in my masters.<p>I know that I am not coming in with same perspective as a lot of the other software engineers&#x2F;graphics developers, but I started learning about quaternions freshman year of college. For aerospace engineering quaternions are used almost exclusively for spacecraft attitude determination and control. For a very dynamic system they are very useful.<p>There are some limitations that I have seen, and I have seen Rodrigues parameters (or modified Rodrigues parameters) used instead which are mentioned near the end of the article.
akeck超过 3 年前
I&#x27;ve been teaching myself geometric algebra which is apparently isomorphic to quaternion algebra. Some people prefer GA for 3D modeling work.
评论 #29511055 未加载
Chabsff超过 3 年前
I&#x27;ve been out of the games sphere for a long time, but is slerp() really the default idiomatic interpolation approach in modern games nowadays?<p>There are a vanishingly small number of scenarios where lerp() + normalize() doesn&#x27;t work perfectly well enough and it is drastically faster and SIMD-friendly. That used to be the case at least.
评论 #29511400 未加载
评论 #29513469 未加载
评论 #29511174 未加载
analog31超过 3 年前
Ask HN: Do quaternions have any interesting properties, akin to those of complex numbers, when calculus is applied? The only application I&#x27;ve ever seen is for doing rotations in computer graphics.
评论 #29515152 未加载
评论 #29512216 未加载
评论 #29512684 未加载
smcameron超过 3 年前
This page is a little more information dense, but it&#x27;s what I learned quaternions from (after bashing my head against it for a couple of weeks) and it&#x27;s good as a refresher because it is so dense.<p><a href="http:&#x2F;&#x2F;www.tutis.ca&#x2F;Rotate&#x2F;7quaternions.htm" rel="nofollow">http:&#x2F;&#x2F;www.tutis.ca&#x2F;Rotate&#x2F;7quaternions.htm</a><p>One thing I didn&#x27;t see in the OP&#x27;s linked article is how to transform a quaternion into a different coordinate system defined by another quaternion. For example, suppose you have a spaceship in a game at an arbitrary orientation defined by Q1 which is a rotation away from a conventional &quot;unrotated&quot; orientation, and you want to input say 5 degrees of yaw to the right. Well, you just construct a quaternion Q2 that is 5 degrees yaw to the right from this conventional unrotated orientation, and you can use quaternion conjugation to transform Q2 into the orientation of Q1 where it can then be applied to the spaceship&#x27;s orientation. OP&#x27;s link mentioned quaternion conjugation, but didn&#x27;t really mention what it was good for. It is described in section IV of the 7quaternions link.
gibsonf1超过 3 年前
The absolute best instruction on quaternions I&#x27;ve seen is the 3Blue1Brown series on your tube and their incredible live quaternion viewer: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=zjMuIxRvygQ&amp;t=24s" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=zjMuIxRvygQ&amp;t=24s</a><p>I was able to learn enough from this to then use quaternion matrix transformations extensively in my startup to incredible effect.
h2odragon超过 3 年前
Very nice thats a reference to keep and come back to thanks.
po1nt超过 3 年前
I&#x27;ve seen dozen of tutorials trying to explain quaternions in multiple analogies and methods. But finally after this tutorial I can finally conclude that I&#x27;m dumb.
2143超过 3 年前
I remember &quot;quarternions&quot; from my math-heavy computer graphics class.<p>Today, I have zero recollection of what they were or why it was in my graphics class. Heck I barely remember anything from that class today, which is ironical considering it was a required class for me to graduate that semester.<p>I wish my job had atleast a little more to do withwhat I learnt in college.<p>(I&#x27;m a web developer, and I&#x27;d like to get closer to the machine.)
btilly超过 3 年前
Quaternion trivia.<p>There was at one point a debate in physics about whether it was better to use quaternions or linear algebra for physics. With i, j, and k being the unit vectors, and the real numbers representing time. In the end, of course, linear algebra won. But we still use i, j, and k as the unit vectors. And in electrical engineering where i wound up hijacked for current, they use j as the square root of -1.
matsemann超过 3 年前
About rotation and interpolation, I once had a bug in animated CSS transforms of all things, in which IE decided to rotate the element around another axis but still end up at the correct position. That one made me raise my eyebrows. No idea if IE actually was in the wrong, though, but in my head interpolating the xyz value I&#x27;m changing feels like the correct way to do it.
marcodiego超过 3 年前
tldr: Simply explained without demonstrations: Quaternions are hypercomplex numbers of the form<p>w + xi + yj + zk<p>Where w, x, y, and z are real and i^2 = j^2 = k^2 = -1 and ij = k, ji = -k, jk = i, kj = -i, ki = j, ik = -j.<p>Being u = (x, y, z) = xi + yj + zk a unitary vector, it is possible rotate any vector q by an angle theta around u by doing:<p>pqp&#x27;<p>where p = cos(theta&#x2F;2) + sin(theta&#x2F;2)u and p&#x27; = cos(theta&#x2F;2) - sin(theta&#x2F;2)u .
评论 #29512228 未加载
评论 #29512436 未加载
评论 #29511826 未加载
评论 #29520977 未加载
评论 #29512103 未加载
darkstarsys超过 3 年前
This is fine; there are lots of similar &quot;intro to quaternions&quot; pages around. One thing I haven&#x27;t seen yet is someone showing how to interpolate between multiple quaternions over time, smoothly. (Hint: it&#x27;s not slerp.) It&#x27;s a non-trivial problem.
评论 #29513152 未加载
评论 #29512968 未加载
imadr超过 3 年前
Very nice interactive visualizations! I&#x27;ve made a similar article some time ago <a href="https:&#x2F;&#x2F;imadr.me&#x2F;rotations-with-quaternions&#x2F;" rel="nofollow">https:&#x2F;&#x2F;imadr.me&#x2F;rotations-with-quaternions&#x2F;</a>
alanh超过 3 年前
Is there a reason why, for me, this post contains `[math processing error]` numerous times instead of math symbols?<p>Update: It’s due to incompatibility with the Dark Reader extension, which causes MathJax to find unexpected nulls in `classList`
dang超过 3 年前
Ongoing related thread:<p><i>Let&#x27;s remove Quaternions from every 3D Engine (2018)</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29512302" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29512302</a>
jcun4128超过 3 年前
Nice I will learn these for IMU stuff, I&#x27;m still a noob currently.
scythe超过 3 年前
I don&#x27;t like this proof of the rotation formula. It seems like juggling formulas without providing any motivation as to how we get there. It does a great job of explaining the problems with other notations, but in demonstrating the formula for quaternion rotation we just pull conjugation out of a hat.<p>First, let&#x27;s ask what it means to rotate around an axis. If you consider rotation of a vector v in a plane A around the unit normal n, you can decompose v as follows:<p>v = proj_n(v) + proj_A(v) = vn + vA<p>Now a 90 degree rotation of v about n is<p>rot_n(90,v) = vn + n &gt;&lt; vA = vn + vR = (v•n)n + v &gt;&lt; n<p>So if we consider v rotated by an angle S around n, we can infer that vn is preserved and the image rot_n(S,vA) can be projected onto vA and vR according to the usual cosine rule for projection:<p>rot_n(S, vA) = cos(S)vA + cos(s-90)vR = cos(S)vA + sin(S)vR<p>Likewise,<p>rot_n(S, v) = cos(S)v + sin(S)rot_n(90, v) = cos(S)v + sin(S)((v•n)n + v &gt;&lt; n)<p>Okay, now what&#x27;s wrong with this formula? What if we want to combine rotations? We&#x27;re stuck, because this &quot;multiplication&quot; isn&#x27;t associative. So we can turn this into a linear transformation and use the matrix representation, which gives a nine-dimensional algebra, although with symmetry you can make it five-dimensional. (The fifth dimension comes from the requirement that both the determinant and the L2 norm of the matrix coefficients are constant, 1 and 3 respectively.)<p>But we have perhaps heard about the quaternions, which <i>are</i> associative. And we might have noticed that Im(v*n), where * denotes quaternion multiplication and Im() discards the real part, is equal to v &gt;&lt; n, viewed as vectors. But multiplication under Im() isn&#x27;t associative either. But we can also define Im() another way, using the apostrophe for conjugation:<p>Im(v*n) = (v*n - (v*n)&#x27;)&#x2F;2 = (v*n - n*v)&#x2F;2<p>since (v*n)&#x27; = n&#x27;*v&#x27; = (-n)*(-v) = n*v for pure imaginary v,n, where we recall that conjugation distributes over products of quaternions at the cost of reversing the order.<p>Now what if we try to construct the rotation again:<p>rot_n(S,v) = cos(S)v + sin(S)(v*n - n*v)&#x2F;2 = (v*(cos(S)+ sin(S)n) - (-cos(S) + sin(S))*v)&#x2F;2 = (v*q(n,S) + q(n,S)&#x27;*v)&#x2F;2<p>Here q(n,S) = cos(S) + sin(S)n is a perfectly reasonable quaternion, and we call it a rotation quaternion. This is now almost associative but not quite. If we combine rotations q and p, we end up with terms like q&#x27;*v*p. How annoying. But it feels like we&#x27;re getting closer, so let&#x27;s see if we can learn anything else about these &quot;sandwich&quot; products.<p>Geometrically, if we rotate the vector forwards and backwards, we should get the same vector. But q(n,-S) = q(n,S)&#x27;, so we must find (we drop the arguments since there is only one q and we are sick of parentheses):<p>((v*q + q&#x27;*v)*q&#x27; + q*(v*q + q&#x27;*v))&#x2F;4 = (v*q*q&#x27; + q*q&#x27;*v + q&#x27;*v*q&#x27; + q*v*q)&#x2F;4 = v<p>Now it&#x27;s not so hard to verify that q*q&#x27; = q&#x27;*q = 1, so we can subtract v&#x2F;2 from both sides and clear the denominator to find the curious-looking lemma:<p>q*v*q + q&#x27;*v*q&#x27; = 2v<p>Now (q&#x27;*v*q&#x27;)&#x27; = q*v&#x27;*q = -q*v*q, the last equality being established because v is imaginary. Therefore:<p>q*v*q - (q*v*q)&#x27; = 2Im(q*v*q) = 2v<p>so Im(q<i>v</i>q) = v, for <i>arbitrary</i> rotation vectors q.<p>Evidently a multiplication by q on the right <i>undoes</i> a multiplication by q on the left, at least when we are talking about imaginary parts, which we were interested in already. So what happens when we take q&#x27;*v*q — the missing sandwich in the above equation? This should give us two rotations in the same direction, since switching sides inverts the rotation and conjugation inverts it again to leave us with the same rotation. But what&#x27;s the use of writing<p>rot_n(2S, v) = Im(q&#x27;*v*q)?<p>Just try it:<p>Im(q&#x27;*v*q) = (q&#x27;*v*q - (q&#x27;*v*q)&#x27;)&#x2F;2 = (q&#x27;*v*q - q&#x27;*v&#x27;*q)&#x2F;2 = (q&#x27;*v*q + q&#x27;*v*q)&#x2F;2 = q&#x27;*v*q!<p>So we now have a formula where everything is in one product. It turns out that the ugly &quot;sandwiches&quot; (we also call this <i>conjugation</i>, which can be confusing) are useful after all. (Explicitly verifying that q&#x27;<i>v</i>q = rot_n(2S, v) is left as an exercise for the reader. See hint [1]. ) Now if we consider a rotation by a second quaternion p, we find:<p>p&#x27;*q&#x27;*v*q*p = (q*p)&#x27;*v*(q*p)<p>by inverting the distributive property for conjugation. So we only need to take one product to combine rotations. Finally, an associative structure!<p>There is only one sticking point left. Evidently q(n,S) corresponds to the transformation rot_n(2S,v). So in order to get rot_n(S, v) we need:<p>Q(n,S) = q(n,S&#x2F;2)<p>But there is one more thing. What happens when S = 360? We all know that a rotation of 360 degrees doesn&#x27;t change the geometry. So shouldn&#x27;t we have Q(n,360) = 1? But in fact:<p>Q(n,360) = q(n,180) = cos(180) + sin(180)n = -1!<p>Of course (-1)&#x27;v(-1) = v.<p>Evidently Q has a period of 720 degrees under rotations S rather than the usual 360, i.e., Q is a spinor. This is sometimes called a &quot;double cover&quot;.<p>In fact, we could also represent rotations and positions with the Pauli spin matrices and complex 2-vectors respectively, although (as in quantum mechanics) we pick up a meaningless global phase, and translation is weird.<p>[1]: Consider various ways of writing parentheses on the expression Im(q*q&#x27;*v*q*q), and show that q(n,S)*q(n,S) = q(n,2S).