How quaternions produce 3D rotation

Поділитися
Вставка
  • Опубліковано 21 лис 2024

КОМЕНТАРІ • 140

  • @PrayAlways-mn7wh
    @PrayAlways-mn7wh 9 місяців тому +13

    Great job and this is by far the best description of a quaternion video I have come across. One comment I have is that "by definition" contains no information why things are the way they, there is no insight or intuitive feel for the description of "the way things are the way they are". "By definition" often is stated by the teacher to the student, to mean do not ask any more questions rather than giving insight. "By definition" should be explained in context, and often it means "logically consistent" or it leads to an "illogically consistent" result, in both cases the "logically consistent" and "illogically consistent" result should be explained. For quaternions, the "by definition" implies a logically consistent subfield of numbers given all pertinent rules are stated and followed. This is why Rowan Hamilton was excited and immediately scratched down the formula i^2=j^2=k^2=i*j*k=-1, he had in essence discovered a new field (to be more accurate a new subfield) of numbers, a new space, which is logically consistent given the stated quaternion rules of multiplication. The focus shouldn't be on "by definition" but the fact that Rowan Hamilton had discovered a new subfield of numbers which was only appreciated once computers and computer games became popular. To see the illogical consistency, one can attempt to create a field or subfield with i and j only, if you attempt to do this you will quickly find there is illogical consistencies within a 3-dimensional world, and one has to go to 4 dimensions (quaternions) with some extra multiplication rules to make a consistent subfield.

    • @hotbit7327
      @hotbit7327 4 місяці тому +3

      Math is often reformulated into better structures but sometimes becomes more difficult to understand.
      I saw Hamilton's paper, and it's one of the best places to start with quaternions, maybe the best.
      First, when he tried to extend complex numbers, he came out with a + bi +cj - note, no k! But when trying to multiply... what the heck is ij? So let's temporarily name their product as k. From there he deduced i^2=j^2=k^2=i*j*k=-1. Thus it was a long intellectual process to get to quaternions.
      Unlike modern papers, I like this old fashion papers more, as they sometimes show The Process of thinking, the train of thoughts of the discoverer.

    • @PrayAlways-mn7wh
      @PrayAlways-mn7wh 4 місяці тому

      @@hotbit7327 The process of discovery is difficult for the first trailblazer since no path exists. To go from real numbers to complex numbers, which Hamilton was a part of, spans from 780 Al-Khwarizmi in linear Algebra solutions to Augustin-Louis Cauchy 1814 complex function theory in an 1814 memoir. William Rowan Hamilton, 1843, was on the post acceptance of complex numbers. It is natural from a linear algebra point of view, btw Hamilton approached the argument by linear algebra and not by spatial geometry argument, to consider a + bi +cj and as you noted there is no k. When you do 3 dimensional complex number multiplication you are left with answering, what is i*j, and it is this question that every morning Hamiton's son was indirectly asking when he asked Hamilton, his father, ""Well, Papa, can you multiply triples?" Eventually this quandary to Hamilon led him to say i*j=k, this was the breakthru moment which led him to scrape on the Dublin Bridge i*j*k=-1. The formula i*j*k=-1 is a consequence of saying/understanding/inventing/utilizing i*j=k, eureka moment, the actual breakthrough was having the insight or courage to try, to understand that i*j=k. The fact that Hamilton expressed Quaternions as Q = w + ix + jy + kz in his classic paper on Quaternions, tells you he understood that the solution of "multiplying triples" was really operating in 4D space and not 3D. 3D multiplying is logically inconsistent, one has to go to an even order dimension for there to be consistent and logical linear algebra multiplications, given special but simple algebraic rules exist. The history of great leaps is strewn with the realization that one lives in the same world before and after the realization, however one sees the world entirely different.

  • @swift4593
    @swift4593 2 роки тому +89

    I love this explanation! I watched 3blue1brown’s video first, but I still had a lot of questions. This video cleared most of those questions for me

    • @TheRojo387
      @TheRojo387 2 роки тому +3

      Assume the result and the initial vector are unit vectors; q encodes angle by a real part much like a dot product = the cosine of half the angle between them, and that AND axis by quaternion parts basically a cross product with a magnitude of the sine of half the angle between them.
      This makes quaternions very powerful for 3D rotations.

    • @fcolecumberri
      @fcolecumberri Рік тому +5

      3blue1brown's video was quite confusing (and I already knew about them), this was much more easier to understand.

  • @jamesking2439
    @jamesking2439 2 роки тому +13

    I finally understand why the double rotation happens and why you need the two sided multiplication to fix it. Thank you for this explanation!

  • @ebolapie
    @ebolapie 4 роки тому +277

    obviously they produce rotation because they're called qua-TURN-ions duh

    • @ARBB1
      @ARBB1 4 роки тому +1

      lol

    • @sagatparkes
      @sagatparkes 3 роки тому +2

      bravo, top comment

    • @cosmicAK
      @cosmicAK 3 роки тому +1

      Crazzzyyyyt

    • @ytcommentsguy
      @ytcommentsguy 2 роки тому +1

      this comment is gold

    • @joshl.8950
      @joshl.8950 Рік тому +2

      I thought it was because you could use them to model an 🧅

  • @noahblaine1901
    @noahblaine1901 Рік тому +1

    I am not sure who this is for. This explanation was quick and dirty and assume a very good understanding of math lingo.

    • @hermit1428
      @hermit1428 Рік тому +1

      if you have some basic knowledge about 3D vector and Euler's formula, you should understand most of the video

  • @oystercatcher943
    @oystercatcher943 4 роки тому +44

    This is by far the BEST description I’ve seen of quarternions brilliantly explaining both the maths and practical side of 3D rotations!

  • @felipeceler
    @felipeceler 4 роки тому +38

    Best explanation so far. Thank you for sharing it !

  • @maxwellchiu9934
    @maxwellchiu9934 2 роки тому +1

    Been looking at quaternions for a year . This is the best source so far. Much appeciated.

  • @justvinchy8776
    @justvinchy8776 3 роки тому +23

    Wow! I didn't imagine someone could explain is as good as you did. Great job.

  • @billpengelly7048
    @billpengelly7048 Рік тому +1

    Weird how it’s almost like the algorithm can read my mind. I’ve been thinking about rotation and higher dimensional space. And then I get recommended a video about quaternions and rotation. 😮

  • @gabrielguitiánestrella
    @gabrielguitiánestrella 4 роки тому +4

    Best video explaining quaternion rotation

  • @안장환-n6w
    @안장환-n6w 11 місяців тому

    By far the BEST description after wandering all the materials.. Thanks !!

  • @Danielle-ew1el
    @Danielle-ew1el 4 місяці тому

    thanks for keeping the quality so high across all your videos!

  • @Tantandev
    @Tantandev 4 роки тому +6

    The animations are next level!

  • @goli292009
    @goli292009 3 роки тому +5

    I loved the video. Hamilton is one of my favorite mathematicians and I really love to talk about him. Quaternions are one of the mathematical concepts invented long time ago which have been used recently. One of the infinite many examples that answers the question "where I will be using this stuff" in math classes. Now, I can give a more clear description about how quaternions are used in animations. Thanks a lot. I sincerely appropriate it.

  • @stevewhitt9109
    @stevewhitt9109 4 місяці тому

    I have watched a lot of vids and wiki on Quaternions, but now finally I understand them. Thanks.

  • @benjaminreynolds5733
    @benjaminreynolds5733 3 роки тому +3

    I just found this channel and I am so happy that I did. Can’t wait to see more videos to come from this channel and hope it will be recognized by the rest of the mathematics community on UA-cam.

  • @0x90meansnop8
    @0x90meansnop8 Рік тому

    Bro, I watched a lot of stuff online for quaternions, but really nobody - and I mean nobody I've encountered - ever explain how to actually rotate things with that.
    Yeah sure, there are some good explanations what quaternions really are and stuff like that, but not a single example on how to do it. Up until this moment I thought quaternionrotation happens only by multiplying a pure quaternion by a rotation quaternion and wondered why my results are so dumb.
    You made it click for me and I want to thank you a lot for that.
    Or how a german would say it: "Der Groschen ist gefallen."
    Have a nice day.

  • @ingiford175
    @ingiford175 2 роки тому

    The why asked around 3:50ish is because it is defined that way, and that definition satisfies that the definition forms a Group, which gives it many properties we can use since it is a group.

  • @pavelperina7629
    @pavelperina7629 Рік тому +2

    This is pretty good. My best understanding so far was somewhat halfway between geometry algebra rotors and quaternions. Like let's rename vector space to i,j,k or e1, e2, e3. Now let's define piecewise multiplication which says that vectors i,j,k are multiplied by right-hand rule (i*j=k), but when they are multiplied by themselves, they become -1. Now use that sandwich multiplication that rotates vector by angle and adds scalar to it and then rotates it again and removes that scalar. In simple cases rotation is halfway and scalar is not produced.
    By the way quaternion interpolation is NOT so easy as advertised. It's same like with complex numbers: multiplying by complex number gives you rotation. Oh, by the way ... if that complex number is on unit circle, otherwise it scales everything too. If you interpolate between two numbers on unit circle/sphere, you get closer to center and they downscale everything. Obvious solution is to normalize interpolated complex number. Hell, we have two problems now - how to normalize it when it passes through zero (interpolating rotation by 180 degrees gives us singularity just like Euler angles) and second problem is that as it gets closer to zero, angular speed increases. In the end, solution to interpolation between two orientations is to use two quaternions to find axis and angle and to interpolate that angle (SLERP - spherical linear interpolation). Then it's questionable if we want to construct quaternion or matrix, because multiplying thousands of vector by a matrix is cheaper operation.
    But there are some nice uses for quaternions, such as storing orientation efficiently, finding vector and angle between two, generating random orientation, likely more complex smooth interpolation without sudden changes of angular velocity at control points.

    • @NXTangl
      @NXTangl Рік тому

      You could always precompute the matrix from the quaternion by applying the transformation to each basis vector...

  • @kartikeyadubey9211
    @kartikeyadubey9211 Рік тому

    Thank you for making this!!! I just learnt about quaternion rotations in class and unfortunately my prof couldn't go into great details (time constraints) about how the rotations are produced.

  • @marcobrini
    @marcobrini 3 роки тому +1

    Extremely well explained! Bravo.

  • @alexmassy
    @alexmassy Рік тому

    Pure concentration of mindblowing explanation ! Thx

  • @jerth
    @jerth 4 місяці тому

    It would be soooooo awesome if you did a video on Rotors and how they differ from Quaternions

  • @MGTOW-nn9ls
    @MGTOW-nn9ls 2 роки тому

    This video is outstanding. The best explanation of this tricky material. Sir, you are low profile genius. Thank you,

  • @movingheadmau8128
    @movingheadmau8128 3 роки тому +5

    That was an amazing explanation, thank you for sharing! :)
    The last part is what flashed me the most. I use quaternions for animation and rotation handling in Unity-Engine and I thought that a quaternion would only be non unique when using a rotation angle which is theta + k*360° where the sin and cos would yield the same results. I had never thought or heard of the fact that there is in fact a way to encode the "long" and the "short" way from one rotation towards another. My assumption was that quaternions would just always yield the shortest rotation. :D

  • @3zdayz
    @3zdayz 4 роки тому +5

    I'm not sure that it matters if you can understand how quaternions 'work' themselves. They are just a math representation of axis and angle, matrices can also be computed from just axis and angle. Turns out if you don't split axis and angle you get (angleZ,angleY,angleZ) which is just a 3D thing. Rotations are 3 dimensional, even though Quaternions have 4 independent parts, to actually represent rotations they have constraints on their possible values. Consider you can represent velocity as speed*direction, angular velocity is angle * direction (angle * axis). And it turns out that vectors in the 3d rotation space have a direction that is the same as the rotation axis and their length determines how much rotation is applied around that axis.
    ... but maybe that's too abstract, rotations are represented with a gyroscope always. The axis of the gyroscope is the axis of rotation, and the angular offset of the rotor is the angle around that axis. All rotation formulas went back to angle and axis, and after some persistence, I now have actually just angle-angle-angle rotations github.com/d3x0r/STFRPhysics , which is just the basic 3 dimensions for rotation. If I took and separated everything into speed*direction instead of velocity, basic motion in 3d space would also appear as a 4d vector.... but really it's just a 4d projection of the basic 3d system.
    ua-cam.com/video/0Y7fmMtlm3Q/v-deo.html
    Quaternions actually fail - (1) you can't recover from the cos(theta/2) the actual rotation angle, but only +/- pi.... also near 0, the sin(theta) * axis you lose the actual axis components of rotation - same at 180 (well, 360 since it's theta/2) ...

    • @JasonCunliffe
      @JasonCunliffe 3 роки тому

      wow = Really intreresting reply. Thanks!

  • @_general_error
    @_general_error Рік тому

    I can see now, that quaternion operations remind me on how charges move in the electromagnetic field. A "moving" charge will produce a circular magnetic field (It's "charge under acceleration produces a circular magnetic field with it's plane oriented perpendicular to the direction of acceleration)...

  • @randysonnicksen9475
    @randysonnicksen9475 4 роки тому +3

    I had to watch this many times but I finally get the whole qvq-1 idea and why we use half the rotation angle. Still mind bending but this helped tremendously. But now I'm struggling to understand how to use this to track my aircrafts orientation. In this video he rotates a vector v using q and q-1. But how do I express a bodies orientation initially with a quaternion that includes all the information (yaw, pitch, roll) of the aircraft. The vector ijk components in v only represent yaw and pitch, but not how the body is rolled. If I start with v = 1,0i,0j,0k which is the quaternion orientation corresponding to yaw, pitch, roll = 0,0,0 then when I left multiply by the rotation matrix q and right multiply by q* or q^-1 the orientation doesn't change. When I only left multiply by q, the orientation seems to move correctly for small angles (pitch and roll < 90 deg)

    • @jamesking2439
      @jamesking2439 2 роки тому

      The qvq* formula is only for applying rotations to vectors of the form xi + yj + zk. To apply one rotation to a other rotation, you just use q2 * q1.

    • @angeldude101
      @angeldude101 2 роки тому

      A rotation doesn't care which direction it's facing as long as it stays within the same plane. If you try to rotate a rotation, then trying to apply the rotation would just snap it back to whatever you're rotating. Composing rotations is distinct from rotating the rotation.

  • @paralol_
    @paralol_ 9 місяців тому

    This was super clear and super fun! It really helped me understand it better, thanks a lot!

  • @indepen
    @indepen Рік тому

    You save me a lot! I just struggle to quaternion but can't understand. thank you so much and thank penguin!

  • @kongolandwalker
    @kongolandwalker Рік тому

    Much better for a noob than 3b1b spheres, but i still don't understand fully. Some parts of the explanation felt like jumps, in the second part of the video.

  • @inrr2318
    @inrr2318 2 роки тому

    I've had trouble understanding it but your video help me a lot . Great work , thank you

  • @keypo790
    @keypo790 Рік тому

    3:53 discovery of that formula ijk = -1 is discovered how, is shown by Jeff Suzuki youtube channel titled " Hamilton and the Quaternions"

  • @tw5718
    @tw5718 2 роки тому

    Very nice. This had all the info I was looking for.

  • @mitrafathianpour1987
    @mitrafathianpour1987 3 роки тому +1

    Thank you so much.. it was useful for me because my thesis is related to this subject and I am really interested in Quaternions because it has special role in our life.

    • @coolfungirl8277
      @coolfungirl8277 2 роки тому

      me too. specifically quaternion phi spiral.

  • @silverlining6824
    @silverlining6824 3 роки тому +2

    All lectures on quarternions are given by mathematicians, via complex numbers. Maybe the following practical application will motivate the need.
    Rotations in 3D can be expressed in terms of two angles, theta and phi. One of them lies in the plane formed by two of the orthogonal axes, say X and Y; and the other in the plane involving the third axis, say X and Z. Any 3D rotation can be expressed as sine and cosine of theta and phi.
    So, what is the problem? Why are the quarternions useful? Trigonometric functions such as sine are computed as infinite series. (Look up Taylor Expansion for the Sine and Cosine functions). Exact solution involves infinitely many terms. Bit real time gaming demands fast computation. Yet, truncation of a series as approximation necessarily involves errors. So what is one to do?
    This is where quarternions come in; they involve only dot and cross products of real numbers - very fast and at the same time exact and precise.
    Now, are you motivated to follow this or any other presentation on quarternions?

  • @fidhalkotta
    @fidhalkotta 2 роки тому

    Fantastic video

  • @2fifty533
    @2fifty533 Рік тому

    3:41 well actually, there _is_ a reason why these rules are true, and you can find this when you replace quaternions with rotors
    quaternions are basically obfuscated rotors, and with rotors you can derive stuff a lot more naturally

  • @maxwellchiu9934
    @maxwellchiu9934 2 роки тому

    Watched this video many times. Only thing I can't figure out is why Cos and Sine are designated on non-traditional axis (see 8:20). If anybody is still monitoring these comments, I would love an explanation. I would have flipped Cos and Sine. Otherwise, best explanation out there!!!

    • @maxwellchiu9934
      @maxwellchiu9934 2 роки тому

      Never mind. I just figured it out. It says so in video that unit vector just needs to be orthogonal.

  • @mueezadam8438
    @mueezadam8438 4 роки тому +7

    7:05 made me giggle

  • @bnhanh7718
    @bnhanh7718 20 днів тому

    I cannot imagine how Rowan Hamilton reacted when he discovered this magic.

  • @SurprisedDivingBoard-vu9rz
    @SurprisedDivingBoard-vu9rz 4 місяці тому

    There is only one force which is fusion. But the balancing act is done by fission and electrical and magnetic and gravity. 4 though 3. Every force is an accelerated frame of reference. Dark matter and dark force is a special frame of reference. Usually hidden casts. Dark matter can sometimes be seen as white matter or normal matter when you almost reach the speed of light. Like when electrons are accelerated to almost speed of light they see nucleus as huge hurdles.

  • @miinyoo
    @miinyoo 2 роки тому

    Simply adorable.

  • @AndyOpaleckych
    @AndyOpaleckych 2 роки тому +1

    This video is awesome. Very nice explanation and funny jokes.
    When penguin pulled out the second pair of 3D glasses I audibly laughed.
    Thank you :)
    PS: I'm just a little disappointed about the flip joke... I hoped he would unfold like the hypersphere in 3B1B video and fold back in. That would be a true 4D flip

  • @Meanderingthinker
    @Meanderingthinker 4 роки тому

    great video, I've been trying to learn quaternions and get my head around it for a while, your video really helped

  • @yolotaylor993
    @yolotaylor993 10 місяців тому

    so interesting viedo, vivid and explicit

  • @krei-se
    @krei-se 2 роки тому

    Thanks for the great video! I really missed a clear math background on this in the interactive videos and wikipedia is not nearly as clear as your descriptions!

  • @markmisin
    @markmisin 3 роки тому

    An amazing explanation!

  • @RegorForgot
    @RegorForgot 4 роки тому +3

    you need more subs! this was hilarious and informative!

  • @tobuslieven
    @tobuslieven 2 роки тому

    The multiplication rules exist because we're saying, "If there was a system that obeyed these rules, what would its behaviours be?" Then we find out those behaviours are really useful.

  • @smizmar8
    @smizmar8 2 роки тому

    "...basically pulled them out of a hat" ..love it 😂

  • @huajinmsl
    @huajinmsl 2 роки тому

    this is the best explaination for quaternions👍

  • @indranildas9565
    @indranildas9565 Рік тому

    This was soooo good. Thanks

  • @hyunjoebrother
    @hyunjoebrother 3 роки тому

    Hey I just watch this video by our University's Professor's Computer Graphics Lecture
    Penguin Voice is VERY Awesome lol

  • @ian731
    @ian731 3 роки тому

    I liked the video and the penguin, bring them both if possible kk

  • @keypo790
    @keypo790 Рік тому

    4:50 rotation should be counter-clockwise when talking about right-multiple of (-i)

  • @npathegenius5733
    @npathegenius5733 4 роки тому +1

    I am amazed at how clearly you pointed out the little details of the multiplications and rotations, I learned quite a bit usage wise. Absolutely well done. Do you have a discord account? I would love to talk to you about quaternions and other mathematics sometime!

  • @AbrahamGarcia-bo3rk
    @AbrahamGarcia-bo3rk 7 місяців тому +1

    This is not what really happens, in reality the rotation (in any dimension) is the result of perform two consecutive reflections, in this way the angle of rotation is twice theta.
    and actually in any form of mathematics where you can represent points and reflections you can also represent rotations, for example with complex numbers, matrices, quaternions, etc.
    Sorry for my bad english

  • @TRIC4pitator
    @TRIC4pitator 3 місяці тому +1

    wait i get it, that's so fucking cool

  • @theultimatereductionist7592
    @theultimatereductionist7592 3 роки тому

    For complex numbers, z, and given positive integer, n, there exist finitely many z in C such that z^n=1.
    But, there exist uncountably infinitely many quarternions, q, in Q, such that q^n=1.
    I had the paper proving this. Short proof. Essentially, Q having dimension 4 over the reals, having 2 extra free real parameters, is what gives us uncountably infinitely many solutions.

  • @tanchienhao
    @tanchienhao 3 роки тому

    amazing video!

  • @N7Tonik
    @N7Tonik 2 роки тому +1

    I think the circle at 4:50 should point to the opposite direction like from j --> k and not k --> j

  • @zhaobryan4441
    @zhaobryan4441 5 місяців тому

    this is the best one

  •  2 роки тому

    Hi I would like to know from what where did you learn about the concept at 7:17. Great video btw!

  • @deepakbamania7945
    @deepakbamania7945 2 роки тому +1

    what is right and left multiply?
    sorry for asking such a basic question

    • @PenguinMaths
      @PenguinMaths  2 роки тому +2

      You might be used to multiplication with real numbers which are commutative, which means the answer is the same even if you change the order of the operands. eg 4 * 5 = 20 and 5 * 4 = 20. This is not true though of quaternion multiplication. If q1 and q2 are quaternions then q1*q2 is not always equal to q2*q1. In the first case we say that we left multiply by q1 and the second case we right multiply by q1. To describe this property we say that quaternion multiplication is not commutative.

  • @windowsxseven
    @windowsxseven 3 роки тому

    swear to god every time the penguin comes up i can't help but ball my fist

  • @harjoat
    @harjoat 2 роки тому

    thanks king

  • @tedsheridan8725
    @tedsheridan8725 Рік тому

    Cool video. But your diagrams at 10:18 on aren't making sense to me. Are the pi's supposed to be radian values of the rotator in quaternion space? or the actual values of the physical rotation? Either way, they don't correspond to the rotation of the igloo in either direction.

  • @keeponspiral7572
    @keeponspiral7572 4 роки тому +1

    nicely done helped btw

  • @angeldude101
    @angeldude101 3 роки тому +2

    Something interesting happens when you rename the unit quanternions a little bit: xy, yz, and xz. But if those were just formed by normal multiplication, then it looks almost like it could've been the cross-product, which is antisymmetric and would suggest that yx, zy, and zx also exist and are the negatives of the first three. So xy^2 = xyxy = -xxyy = -1... huh. and xyyz = xz... hmm...
    Perhaps the quaternion products are more fundamental than you claim here when you suggest that they were just defined this way. (I did gloss over xx = 1 etc. There's a lot more going on here that is _really_ interesting. Among other things, it _does_ become obvious that these become a rotation considering xy can be read as the rotation the brings x to y.)

  • @festa1999
    @festa1999 5 місяців тому

    Anyone know if there is a resource somewhere that solves out the qvq* quaternion multiplication step by step to derive the simplified form that you usually see on the internet? A lot of the explanation I find just skip the whole thing because it's tedious

  • @SuperDeadparrot
    @SuperDeadparrot Рік тому

    When using quarternions with complex coefficients, does complex i commute with quarternion i,j,k or not?

  • @sanketvaria9734
    @sanketvaria9734 4 роки тому +2

    This is hard as hell

  • @keypo790
    @keypo790 Рік тому

    So Mr Hamilton basically invented(i dont know maybe discover a rules) quaternions that describes the rotation(

  • @OmarAGarciaA
    @OmarAGarciaA 5 місяців тому

    I think the circle (jk) at second 4:50 is mistakenly drawn. The arrows should poiont the other way around

  • @TheRojo387
    @TheRojo387 2 роки тому

    Multiplying two pure quaternions is the equivalent of deriving two vectors' dot product AND cross product in one fell swoop. Well, almost; quaternion multiplication produces the NEGATION of the vector equivalent dot product.

  • @XYZ_youtube
    @XYZ_youtube 9 місяців тому +1

    5:50 k!, k factorial xD

  • @librarymn7251
    @librarymn7251 3 роки тому

    Amazing...

  • @MacCarell
    @MacCarell 3 роки тому

    So basically point in a direction with a 3d vector then rotate around it by theta degrees?

  • @chilinouillesdepommesdeter819
    @chilinouillesdepommesdeter819 3 роки тому

    PenguinMaths,I found your vulkan-diagrams repo recently,and those diagrams are so great,could tell me what software you use to make them?

    • @PenguinMaths
      @PenguinMaths  3 роки тому +1

      Thanks! I use inkscape to make the diagrams

  • @ww8720
    @ww8720 3 роки тому

    if the intended quaternion (q ) is (1,0,0,0) but I get q1=(0.328,-0.395,0.575,-0.6337) instead, how do I rotate q1 to get to q?

  • @Navhkrin
    @Navhkrin 4 роки тому

    I didnt know you guys had a mind reading penguin at home

  • @adolforosado
    @adolforosado 3 роки тому

    If you like Quaternions, you may want to give the video I posted a look and a comment. Not mine, Credit where it's due.

  • @Spiegelradtransformation
    @Spiegelradtransformation 11 місяців тому

    This is by definition. What is in mechanic ?

  • @randysonnicksen9475
    @randysonnicksen9475 4 роки тому

    So I went through the tedious exercise of expanding out qp = (A + Bi + Cj + Dk)(a + bi + cj + dk) and then right multiplying the result with the conjugate of q (q*) which is A - Bi - Cj - Dk) and after simplifying, each of the coefficients of the imaginary vector terms are products of the initial orientation (p)'s imaginary terms b, c and d. Therefore, if the initial orientation is aligned with the reference frame (1,0,0,0) the resulting final orientation after any rotation by q (left multiply by q, then right multiply by q*) has imaginary terms which are all zero. Why doesn't rotation work for the initial orientation of 1,0,0,0???
    The result of qpq* with q and p defined as above is:
    a(AA + BB + CC + DD)
    + i [ b(AA + BB - CC - DD) + 2c(BC - AD) + 2d(AD + BD)]
    +j [ 2b(AD+BC) + c(AA - BB + CC - DD) + 2d(CD - AB)]
    +k [2b(BD - AC) + 2c(AB + CD) + d(AA - BB - CC + DD)]
    You can see that the coefficients of the resulting imaginary terms (i, j, k) are all the result of products of the initial orientation vector coefficients (b, c and d). What am I missing here? I thought that if I started with an initial orientation aligned with my reference frame, and then performed a rotation on that orientation, I would get a result which represents the final orientation.
    Is this a special case (1,0,0,0) where the rotation formula doesn't work? That doesn't sound likely because it would mean the quaternion method would have it's own form of "gimbal lock". Can someone explain this??

    • @PenguinMaths
      @PenguinMaths  4 роки тому +1

      Remember that v needs to be a pure quaternion, ie the real part should be 0 (6:26). Because we are only rotating a 3D vector which we specify as the vector part of v (what you have named p). Since you have specified the whole vector part of p as the zero vector, after rotation it remains the zero vector which is what you noticed by observing 'a' doesn't show up in the expressions for the coefficients of i, j, or k. Also good for you for working this out, this is how you learn!

    • @randysonnicksen9475
      @randysonnicksen9475 4 роки тому

      @@PenguinMaths Thanks for the reply. So I'm using this for a flight controller. I need to define an initial orientation from which I can begin performing rotations. How do I express an initial orientation that will work with quaternion multiplication? How do I express yaw = 0, roll = 0 pitch=0 in an orientation quaternion. If I plug these numbers into an Euler to Quaternion formula I get 1,0i,0j,0k .
      And If I'm to use a "pure quaternion", how can that fully define the orientation of my aircraft. It tells the direction I'm pointed, but doesn't tell anything about how it is rotated about that vector.
      If the real coefficient is 0, that implies that cos(theta/2) = 0 so theta = 180 degrees. So If I define my reference frame as i=North, j = West and k = up, and I start my aircraft level and pointing north, how do I express this as a quaternion? Would I say 0, 0i, 0j, -k (negative k because the 0 real part implies I'm rotated 180 degrees around the k vector? Do you see my quandry here? Maybe I'm mis-applying quaternions, because I thought they could be used to fully define the orientation, but if that first orientation doesn't include information about the rotation around the vector, it doesn't fully define the aircraft orientation.

    • @PenguinMaths
      @PenguinMaths  4 роки тому

      @@randysonnicksen9475 I have only used quaternions for rotations in 3D graphics and don't have experience with robotics so I can't speak much to that. But I think you're confusing the roles of the quaternions q and v. When you plug in 0 to the Euler to quaternion calculator you get 1 + 0i + 0j + 0k = 1 since this is a rotation of 0 degrees, aka doing nothing. This is the q quaternion, not v which you're treating it as. So in this case qvq* = 1*v*1 = v so then v is rotated by 0 degrees. And the orientation also is specified by q, not v, which I think is where your confusion is coming from. It's assumed you already have three basis vectors e1, e2, e3 which is your starting orientation. Then you can specify any orientation with the quaternion q, which can transform your basis vectors to qe1q*, qe2q*, qe3q*, which is your original basis vectors rotated to a new orientation.
      So it's entirely the q quaternion that specifies an orientation and it's the v quaternion that is being rotated to that orientation. So in a sense, every atom of your craft is being represented by it's own quaternion v which specifies the 3D location of that atom from the origin. You could say its starting orientation is specified by the quaternion q_0=1, the "default" orientation. Then you can specify any other orientation with q, which means that for every atom v of the craft, it's new position for that orientation is given by qvq*. In computer graphics this is true except replace the word 'atom' with 'vertex'.

    • @randysonnicksen9475
      @randysonnicksen9475 4 роки тому +1

      @@PenguinMaths I think you've nailed it. I was thinking that a quaternion could fully represent the 3D orientation, but no, it only represents a rotation of a point (or 3D vector) to a new point or vector. Just prior to reading your reply I had the idea to use quaternions to track TWO vectors, say the UP vector, and the NORTH vector in 3D space. Any two orthogonal vectors fully define a coordinate system (the 3rd dimension is defined by the normal to the plane defined by the two orthogonal vectors.) While it's not quite as elegant as I was hoping (one calculation), it is still quite efficient to multiply 2 vectors by q and q* to determine the new orientation. I'll still need to figure out how to convert the results into an orientation with respect to the global inertia reference frame, but that should be a simpler problem.
      I did run across a paper which indicated that it's easiest to do all (quaternion) calcs with reference to the body frame because the gyroscope sensors are attached to the body. It's easier to track the rotation of the earth around the body than to track the body with respect to the earth frame. This same paper also suggested that I could treat the 3 separate gyro readings (x,y,z) as a vector with magnitude sqrt(xx+yy+zz) and do a single rotation instead of rotating around each axis separately. (cool).
      AND - using a 3D magnetometer and 3D accelerometer, I can get the vectors for magnetic north, and up to "calibrate" my initial conditions, and correct for drift due to offsets in the gyro readings. Thanks for taking the time to read and respond, and to clarify how I was mis-applying the quaternion "v". Much appreciated.

    • @randysonnicksen9475
      @randysonnicksen9475 4 роки тому +8

      I did some more research and found the answer I was looking for. In this article www.samba.org/tridge/UAV/madgwick_internal_report.pdf Madgwick explains that two rotation quaternions can be combined with simple multiplication, and the result is a single rotation quaternion which expresses the orientation of a body (frame) with respect to some other frame (say the earth frame). So in this way, the rotation quaternion IS a complete definition of a bodies orientation, whereas the single pure vector is not. Furthermore, we don't need to track two or three vectors to fully define the new orientation. Additionally, we don't need to do a double multiplication qv and (qv)q-1 because the quaternion q contains all the information I need. So if the earth frame is represented as 1,0,0,0 (no rotation), then the orientation of a rotated body is simply the product of all individual sequential rotations multiplied together. This explains what I saw in my arduino program where if I multipled 1,0,0,0 by q only, and not (qv)q-1, I got a result that looked like a valid orientation. I feel like a lot of the information (videos and papers) out there fail to point this out and I feel it is a really important feature of quaternions.
      BTW, I don't need a reply, but I wanted to post this so that others who are looking for the same information can discover what I did with maybe a little less pain.

  • @anfrollex
    @anfrollex Рік тому

    How do you do that voice for penguin character? Is it a bot a real person narrating?

  • @gmendozafiee
    @gmendozafiee 3 роки тому +1

    i still dont understant, why you said "same two circle" on 4:09min, i only see one circle and one line, why 2 circle?

    • @hush_dxl
      @hush_dxl 3 роки тому

      the second circle is the line itself: the first circle is in the ijk space, the second one is related with the *real* axis. watch 7:19 for reference

  • @NoNameNoShame22
    @NoNameNoShame22 6 місяців тому

    “If you like math” no sir, i do not but I’m out of options…

  • @alexmc477
    @alexmc477 3 роки тому +1

    Holy shit it just clicked

  • @keeravan
    @keeravan 3 місяці тому

    WHY IN COORDINATE SYSTEM CENTER IS NOT ORIGIN = (0, 0 ,0) INSTEAD IT IS 1.TIMING 10.04 SECS

  • @trolleymouse
    @trolleymouse Рік тому

    Best explanation I've found and I still don't get it.

  • @thomasolson7447
    @thomasolson7447 2 роки тому

    My avatar and banner are quaternions in 3d.

  • @zdspider6778
    @zdspider6778 5 місяців тому

    _Quay-tonion._ 🤔

  • @0zyris
    @0zyris 3 місяці тому

    What do you have to know first for this to make any sense at all? Feels so much like a foreign language.

  • @ZMacZ
    @ZMacZ 2 роки тому

    7:05 Funny..

  • @aashsyed1277
    @aashsyed1277 2 роки тому

    2d**

  • @bios546
    @bios546 4 роки тому

    +1 if you've got navigation test tomorrow

  • @Bruhlol616
    @Bruhlol616 5 місяців тому

    İm in 3rgd grade but i understand this

  • @GitBits
    @GitBits 2 роки тому

    Very instructive, thank you. However, your statement at 3:43 "We define the rules of quaternion multiplication" on a background of 9 equations, is a bit misleading. Yes, the rules of quaternion multiplication are defined (They were defined by Hamilton), but they consist of 4 equations, not 9 :
    i2 = j2 = k2 = ijk = -1
    The other equations that you present are of course helpful for actually carrying out the calculations, but they should be understood as being derived from Hamilton's 4 original equations (above). For details on how to do these derivations, see
    ua-cam.com/video/jlskQDR8-bY/v-deo.html