Let's remove Quaternions from every 3D Engine: Intro to Rotors from Geometric Algebra

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 พ.ย. 2024

ความคิดเห็น • 689

  • @sirnukesalot24
    @sirnukesalot24 3 ปีที่แล้ว +128

    Looks like the rotor isn't just a more generalized form that captures the quaternion, it captures the spinor as well. It might be worth pointing that out since spinors have been popping up in the public discussion within the last year or so.

  • @Toxo
    @Toxo 3 ปีที่แล้ว +472

    If you really want to make an argument for replacing quaternions, I think you should establish that the new way is computationally equally or less expensive than quaternions. Using black boxes are a non-issue in software engineering, provided they do what you intended every time and aren't inefficient. Anyway, your video is really well made and I am grateful you made it!

    • @porky1118
      @porky1118 3 ปีที่แล้ว +22

      They are isomorphic. The implementation would basically be the same.

    • @Ruktiet
      @Ruktiet 3 ปีที่แล้ว +74

      @@porky1118 that's not what isomorphism implies. You could have an isomorphic structure that has representations and operations on those representations involving lots of computations compared to another one.

    • @porky1118
      @porky1118 3 ปีที่แล้ว +9

      @@Ruktiet I would expect some data type to already use the most efficient algorithm possible. So if some isomorphic data structure to quaternions existed, which is more efficient, it would probably already have been used internally.
      Isomorphic would just mean, they have the same API, maybe with different names.

    • @z-beeblebrox
      @z-beeblebrox 3 ปีที่แล้ว +73

      @@porky1118 "I would expect some data type to already use the most efficient algorithm possible."
      That is an INCREDIBLY optimistic assumption

    • @levknoblock88
      @levknoblock88 3 ปีที่แล้ว +53

      @@Ruktiet Not only an optimistic assumption, but also an unrealistic one. Libraries for the same things constantly disagree on which data structures to use, even for something as common and 'simple' as matrix multiplication. On top of that, there are a lot of problems in CS where we just don't know what the most efficient approach is. And even then, the "best approach" changes depending on what computer you run the code on, so it's even more messy than that.

  • @schwajj
    @schwajj 4 ปีที่แล้ว +239

    Thanks for a great explanation. I have a constructive criticism... I find it jarring when one equation cross-fades into an equivalent equation. I would prefer to have a new equation fade in below, so I can verify equivalence myself. This would make it easy to pause the video to compare the two equations. Instead, I have to rewind the video to see the previous equation. Going back and forth between the two equations is tedious. Thanks again!

    • @schwajj
      @schwajj 4 ปีที่แล้ว +36

      An example of what I have problems with is 6:45, and what works for me is 13:05

    • @marctenbosch
      @marctenbosch  4 ปีที่แล้ว +78

      Thank you for your suggestion.

    • @LeonardPauli
      @LeonardPauli 3 ปีที่แล้ว +12

      @@marctenbosch I believe animations can help a lot, as long as they are connected to what's happening mathematically. I usually really enjoy the in-place animations, but yeah, in the 6:45 example, it was a bit jarring; for just elimination, fade is great, though when a term is moved, a movement animation may suitable (or just fall back on a new line).

    • @badradish2116
      @badradish2116 3 ปีที่แล้ว +2

      colorizing the differences might help too

  • @AThagoras
    @AThagoras 5 หลายเดือนก่อน +3

    Best introduction to geometric algebra that I've ever seen. I've used quaternions for graphics and always thought geometric algebra was too complicated because of the different products and mixed type sums etc. but when it's clearly explained, it makes sense and seems simpler to work with because you can use geometric intuition to break up calculations instead of having to do a lot of algebra and hope you got it right.

  • @lukostello
    @lukostello 4 ปีที่แล้ว +238

    I feel like there is an untold story of how you tried to code rotations in 4d for miagakure and discovered 4d rotors rather than a 5d solution. Then were like "well jeez if we dont need a 5th dimension for 4d rotations then why would we need a 4th dimension for 3d rotations?"

    • @marctenbosch
      @marctenbosch  4 ปีที่แล้ว +177

      Yeah, except it is 8D, not 5D, ahah: marctenbosch.com/news/2011/05/4d-rotations-and-the-4d-equivalent-of-quaternions/

    • @petrowi
      @petrowi 4 ปีที่แล้ว +23

      @@marctenbosch I'd be very curious to see a similar video for octonions. Loved this presentation

    • @williamchamberlain2263
      @williamchamberlain2263 4 ปีที่แล้ว +20

      @@petrowi too right - octonions get far too much play in game engines.

    • @petrowi
      @petrowi 4 ปีที่แล้ว +4

      @@williamchamberlain2263 my curiosity on the subject is not related to game engines

    • @mudkip_btw
      @mudkip_btw 3 ปีที่แล้ว +43

      @@frankdimeglio8216 very elaborate shitpost

  • @mudkip_btw
    @mudkip_btw 3 ปีที่แล้ว +39

    I have known geometric algebra was supposed to be more intuitive for a while. Recently I've used quaternions for the first time and I was really enthusiastic about how numerically efficient and stable they were, but I don't fully understand them. I think the next time I do a project involving 3d rotations, I will use the geometric algebra formalism. Thanks!

  • @DarkCloud7
    @DarkCloud7 2 ปีที่แล้ว +10

    It took a bit to digest, but after reviewing the article a few times I felt a sense of enlightenment. The stuff that seemed so out of the blue before (like the cross product) now fall into place so naturally. Thank you very much for this intro to geometric algebra.

  • @ryanrising2237
    @ryanrising2237 4 ปีที่แล้ว +795

    Why do I feel like I’m being sold on some kind of mathematical cult?

    • @kungfooman
      @kungfooman 4 ปีที่แล้ว +20

      Because it looks fancy in ganja.js :^)

    • @nissimhadar
      @nissimhadar 4 ปีที่แล้ว +8

      Do you think he is wrong?

    • @yabgu79
      @yabgu79 3 ปีที่แล้ว +29

      I feel like it is intentionally obfuscated too. Geometric (Clifford) algebra is really so much better and easier to understand it cannot be a coincidence it is this hidden while videos like these exist: th-cam.com/video/d4EgbgTm0Bg/w-d-xo.html and they always use sentences as such: "See this figure is called linelander (I see myself there), his mind is so simple he cannot understand 4d concepts bla bla bla......". Isn't it too common these words used to be a coincidence? "You cannot understand because you are like line 2d lander trying to understand 3d while we demigods can grasp 4d space and all the magic...". Well... How about now; After watching this video I completely understand what 3d rotation is, so who was accusing me of being a simpleton...

    • @marctenbosch
      @marctenbosch  3 ปีที่แล้ว +152

      I think the real cult is the quaternion guys 😂 since the real cult is always the other guys 😂. Seriously though, my sense is that it started with Hamilton and how he really wanted quaternions to contain 3D vectors (when in fact they contain bivectors) and trying to convince everyone of that, that we still feel the ripples today. If you're interested, look up the articles on the history at the end of the article: marctenbosch.com/quaternions/#history

    • @maxwellsequation4887
      @maxwellsequation4887 3 ปีที่แล้ว +12

      @@marctenbosch Hmmmm it feels there is going to be crusades soon.....

  • @Alexander_Sannikov
    @Alexander_Sannikov 3 ปีที่แล้ว +22

    For me the similarities between hypercomplex basis and a bivector basis were always obvious because I always thought of ijk basis as a bivector basis to start with. But I never realised that reflection about a and then reflection about b is the same is rotating by twice the angle between a and b. This actually was very insightful.

    • @writerightmathnation9481
      @writerightmathnation9481 3 ปีที่แล้ว +2

      There are lots of useful resources if you really want to learn such stuff: Hestenes' Space-Time Algebra book, Hoffman & Kunze's Linear Algebra book, and Anadijiban Das' Tensor Analysis book. In this sense, a bivector is nothing but an element of a tensor product of a vector space with itself, and a bivector basis should naturally be a member of the canonical basis for such a tensor product, constructed using the tensor products of pairs of members of a given basis for the original vector space.

  • @Pherecydes
    @Pherecydes ปีที่แล้ว +7

    Brilliant! I have wondered about cross products for decades, and even after working through the derivations algebraically they never really clicked. This video was a jolt of enlightenment. Thank you.

  • @eeromutka
    @eeromutka 4 ปีที่แล้ว +87

    Fantastic read/video! One thing that bugs me though if the fact that you're explaining everything in terms of XY, YZ and XZ planes, but things would get more consistent if you used YZ, ZX and XY planes instead. There are a couple of things that this fixes, let me explain.
    Firstly, if you take the cross product of the basis vectors of the XY plane, you'll get Z=1. For YZ plane, you'll get X=1. But with XZ, you'll get Y=-1. Seems very wrong right? Using ZX not only fixes this, but also it's quite logical that Y comes after X, Z comes after Y and, after wrapping around, X comes after Z.
    At 7:43, you explain how the outer product is almost like the cross product, but the value for Y is negative. But by using ZX, this also gets fixed and the values are identical! Also, if you fix the order so that it's [YZ, ZX, XY] and not [XY, YZ, XZ], it'd match up with the rows of the matrix you'd get from a cross product.

    • @marctenbosch
      @marctenbosch  4 ปีที่แล้ว +40

      Yeah I think both have advantages. I have an aside in the article (marctenbosch.com/quaternions/) that says:
      "I chose a lexicographic order for the basis because it is easy to remember, but choosing z∧x instead of x∧z would make the signs the same. It would also makes the bivector basis directions consistent. This is the right hand rule, except the understandable non-arbitrary version :)"
      It does become more difficult to define in 4D and higher: should it be YW or WY ? So I think lexicographic order is helpful then.

    • @OMGclueless
      @OMGclueless 3 ปีที่แล้ว +5

      ​@@marctenbosch If you choose an ordering and then take the (circular) pairs of unit vectors as your bivector basis, it should work out in all dimensions, no? Sure, it doesn't tell you whether it's `yw` or `wy`, but neither of those bivectors are basis bivectors in the standard basis. And if you were to project the 4D space into a 3D space the choice of `yw` or `wy` would be dictated pretty naturally by your choice of projection following the same logic (for example, in `wxy` space it's `yw` and in `wyz` space it's `wy`).

    • @theodorostsilikis4025
      @theodorostsilikis4025 3 ปีที่แล้ว +10

      Staying consistant with the permutations becomes much more relevant in higher dimensions .In 3vectors xyz,yzx,zxy have the same sign,imagine xyz,yzx,-xzy...

    • @ZedaZ80
      @ZedaZ80 3 ปีที่แล้ว +1

      Oh, that's pretty helpful :0

    • @angeldude101
      @angeldude101 2 ปีที่แล้ว +2

      Of of the things I love about geometric algebra is that it doesn't matter whether you use xz or zx, because the two will always be negatives of each other. With quaternions and cross products, there is only 1 choice of basis and it's rather arbitrary. With geometric algebra, you have two options for each basis bivector and can store them however you like as long as you understand xz = -zx. Some sources use wx, wy, and wz, along with a cyclic permutation of the other 3, while others use xw, yw, and zw.

  • @NikolajKuntner
    @NikolajKuntner 3 ปีที่แล้ว +26

    I feel you start this out with a non-argument: "I wasn't taught why quaternions work, so here's an alternative..."

    • @LukeVilent
      @LukeVilent 3 ปีที่แล้ว +16

      "Working out quaternions is hard, so let's replace this rusty crap with the algebraic completion of 2-wedge products over three generators, which are quaternions, but now lactose and gluten free."

    • @NikolajKuntner
      @NikolajKuntner 3 ปีที่แล้ว

      @@LukeVilent lol

  • @EMB3D
    @EMB3D 2 ปีที่แล้ว +5

    1:43 if you think about matricies, and vectors. If you want 3D transformation (nost just rotation but translation and scaling) with them, you need one extra dimension, hence a 4x4 matricies and x,y,z,w homogenous vectors are needed in to order express such.

    • @linuxp00
      @linuxp00 4 หลายเดือนก่อน

      Real 4×4 or Complex 2×2, aka, Pauli Matrices

  • @ChrisOffner
    @ChrisOffner 4 ปีที่แล้ว +35

    Can you recommend any great resources (books, lecture playlists, etc.) on Geometric Algebra?

    • @elijahlape
      @elijahlape 4 ปีที่แล้ว +14

      A nice introductory book is Volume 1 from this series: foundationsofgameenginedev.com/
      Playlist: th-cam.com/play/PLpzmRsG7u_gqaTo_vEseQ7U8KFvtiJY4K.html

    • @writerightmathnation9481
      @writerightmathnation9481 3 ปีที่แล้ว +1

      Hestenes

    • @ChrisOffner
      @ChrisOffner 3 ปีที่แล้ว +1

      @@writerightmathnation9481 Do you mean "Clifford algebra to geometric calculus: A unified language for mathematics and physics" by David Hestenes and Garret Sobczyk?

    • @plus-sign
      @plus-sign 3 ปีที่แล้ว +3

      I'm reading "Geometric Algebra for Computer Science" (Dorst, 2007). Good if you're a programmer.

    • @ChrisOffner
      @ChrisOffner 3 ปีที่แล้ว

      @@plus-sign Cheers, I'll check it out.

  • @PS3PCDJ
    @PS3PCDJ 3 ปีที่แล้ว +8

    Cant wait for Randy to find this and then watch him go and refactor most of his code to get rid of the Quaternions he just learned about and implemented into his game

    • @LukeVilent
      @LukeVilent 3 ปีที่แล้ว +3

      And find out that he replaced quaternions with... quaternions.

  • @pouyakassaeiyan2694
    @pouyakassaeiyan2694 7 หลายเดือนก่อน +1

    I have watched many tutorials, and this one by far is the best. Thanks.

  • @Alexander_Sannikov
    @Alexander_Sannikov 3 ปีที่แล้ว +12

    I think the greatest confusion in understanding quaternions comes from the fact that in 3d the dimentionality of an axis of rotation is the same as dimentionality of the space itself. This is not the case for any(?) other dimensionality. Because of this, we think of rotation axes as if they were part of the same space when they are really not, which's particularly obvious in non-orthogonal bases.

    • @writerightmathnation9481
      @writerightmathnation9481 3 ปีที่แล้ว +1

      What do you mean by "dimensionality of an axis of rotation", please? Let's stick to the three dimensional case for now. In my view, the dimension of an axis of rotation in three-space is 1 because it is a line ( a translate of a one dimensional real subspace of thre space), but the dimension of three-space is not 1. The term "dimensionality" is strange to me and undefined in this context.

    • @Alexander_Sannikov
      @Alexander_Sannikov 3 ปีที่แล้ว +3

      @@writerightmathnation9481 by dimensionality i mean "units of measure". dimensionality of axis of rotation is not units of vector space, it's units of bivector space. So it's not [meters]^3, but rather [meters*meters]^3

    • @JivanPal
      @JivanPal 3 ปีที่แล้ว

      ​@@Alexander_Sannikov, rotations are dimensionless, since they are angles. The result of a cross product merely encodes a plane and a scalar corresponding to something related to that plane (e.g. a rotation, angular velocity, torque, etc. in that plane). A vector is simply a nice way to encode both of these things together.

    • @Alexander_Sannikov
      @Alexander_Sannikov 3 ปีที่แล้ว +1

      @@JivanPal rotations are only dimensionless in a dimensionless space. But you can easily consider a space that has its own dimensionality. In fact, typically spaces in physics are measured in physical units of length (meters, etc), but you can easily imagine a hypothetical abstract space where each basis vector has its own unit of measure associated with it. Since decomposition by these unit vectors is unique, each vector of this space will have a unique measure composition as well. And then you'll notice that in order to define a rotation axis in this hypothetical space, you CAN'T use a vector of the same space, you need to use a vector of so-called dual space, and dual space is a space of bivectors.
      Another hint to why rotation axis can not have the same dimensionality in general as the space itself: only in 3d axis of rotation has the same number of dimensions as a vector that it rotates. For example, in 2d space your axis of rotation is 1d, and in 4d space your axis of rotation has 6 components (which is the dimentionality of dual space associated with it).

    • @porky1118
      @porky1118 3 ปีที่แล้ว +1

      @@writerightmathnation9481 Dimension is the correct term: en.wikipedia.org/wiki/Vector_space#Basis_and_dimension

  • @r.pizzamonkey7379
    @r.pizzamonkey7379 3 ปีที่แล้ว +48

    I feel like the name is slightly clickbait. What it seems like you're actually arguing here is a different way to teach quaternions. I don't think using this approach would actually change anything about how a 3D engine is implemented under the hood.
    At best it would be some different identifiers and documentation, but once you compile and optimize everything you're left with the same end product.

    • @primarysecondaryxd
      @primarysecondaryxd 3 ปีที่แล้ว +3

      Check out watch?v=tX4H_ctggYo if you're interested.
      I think it works out to a very small memory advantage over matrices in the 2d/3d case if the whole thing was implemented under the hood (otherwise I think it all works within one matrix per object), with much more generality between 2d and 3d as well as simplifying the implementation (less exceptions to deal with, everything is one type, 2d functions work for 3d and vice versa) from the programmer's side.
      That said it's hard to use when game engines don't have a native implementation and you have to translate between everything yourself.

    • @r.pizzamonkey7379
      @r.pizzamonkey7379 3 ปีที่แล้ว +9

      @@primarysecondaryxd what I mean is if j really is just yz, and you don't want to implement an entire general CAS solver when all you need is a few specific cases, you're going to end up with the same ijk lookup table just written with the bivectors, as seen in section 3.2. I mean, it's the same as your standard quaternion table except they omit the identity operation (1x), but it's not really necessary there either.

    • @MathAndComputers
      @MathAndComputers 3 ปีที่แล้ว

      I noticed this, too, and also that quaternions usually aren't used for rotating vectors, since for more than a handful of vectors, it's more efficient to convert to a rotation matrix first and use that. Quaternions are usually used for composing transforms or blending transforms, since they're more efficient than matrices for those, at which point, I'd be curious whether dropping the real component like this might lead to inefficiency. 🤔

    • @LukeVilent
      @LukeVilent 3 ปีที่แล้ว

      @@MathAndComputers You're not dropping the real component here. Since rotors and quaternions are the same, identical thing, captured by the math term "isomorphic", a product of two general rotors will almost certainly produce a rotor with a real part.
      UPD. Maybe, you were meaning replacing unit quaternions with their Lie algebra counterparts. I've tried that - not the best idea.

    • @MathAndComputers
      @MathAndComputers 3 ปีที่แล้ว +1

      @@LukeVilent Isomorphic doesn't mean that they're the same, identical thing; it means that they're mathematically interchangeable. As described in the video, rotors are 3 components; quaternions are 4 components, i.e. the 3 components of rotors, plus an additional component that can be computed from the other 3 (ignoring the sign) if only unit quaternions are relevant. The sign is sometimes needed, which technically makes them not isomorphic, but even if we ignore that, and even if isomorphic did mean that they're exactly the same, then "rotor" would be a redundant term for "quaternion", and removing quaternions from all 3D engines would mean removing rotors from all 3D engines, and the title of the video is still contradicted by the video, which is pretty much the point I was making in the first place.

  • @SteinCodes
    @SteinCodes 3 ปีที่แล้ว +2

    Sorry for only watching it now, but incredible stuff, I feel dumb for just accepting quaternions in all my code as it is, till now. They would have made the like of high school me, trying to learn graphics programming so much easier, thanks a lot.
    I had taken multiple courses in Maths, wasted several hours working on geometric algebra but never did I think of using it. So thanks a lot. 😊
    I will try and port as much of my code to rotors as possible, and only leave a quaternion api as a secondary solution. :)

  • @JustAnotherAlchemist
    @JustAnotherAlchemist 9 วันที่ผ่านมา

    Really like the mixed content type uploads. Very helpful.

  • @monke5100
    @monke5100 ปีที่แล้ว +2

    Isn't it ironic that this guy is teaching us things that should prevent us from thinking in 4 dimensions?

    • @linuxp00
      @linuxp00 4 หลายเดือนก่อน +2

      Actually not, quaternions are not geometrical dimensions, they're algebraic dimensions. For reasons too long to explain here, the true dimensional upgrade is given by a sum of a vector and two quaternion bases: [t, x, y, z] (quadriposition); [tx, ty, tz] (hyperbolic rotations / relativistic boosts), [xy, yz, zx] (spherical rotations / orientations)

  • @rotgertesla
    @rotgertesla 2 ปีที่แล้ว +1

    I really like the interactive article you provided with your video! Very good idea. Suggestion : it would be nice if we could pause the animations in the interactive doc

  • @pepe6666
    @pepe6666 ปีที่แล้ว

    this is awesome. i am a huge fan of going back to basic principals when the rules of thumb youve been given dont hold up. i really appreciate this approach

  • @QRebound
    @QRebound 4 ปีที่แล้ว +42

    Great video, but early on you say that rotors and quaternions are isomorphic, and in the same breath say that quaternions have less capabilities than rotors. That would mean they aren't isomorphic, wouldn't it? If they truly are isomorphic, it may be more *awkward* to use quaternions for some things, but they'd still be capable of everything rotors are.

    • @marctenbosch
      @marctenbosch  4 ปีที่แล้ว +43

      3D Rotors (the even subalgebra of 3D geometric algebra) are isomorphic to quaternions, but they can also operate on things that are not isomorphic to quaternions via the full geometric algebra.

    • @trueriver1950
      @trueriver1950 3 ปีที่แล้ว +3

      @@marctenbosch
      So more exactly what you meant is that rotors contain a subset that is isomorphic to quarternions?
      That might make rotors a useful extension to quarternions even apart from being more intuitive.
      Do you have an example of a physical effect that can be modelled by a rotor operation but not with quarternions?

    • @elkinmontoya9640
      @elkinmontoya9640 3 ปีที่แล้ว

      @@marctenbosch Is this isomorphism local, or global?

    • @polyhistorphilomath
      @polyhistorphilomath 3 ปีที่แล้ว +1

      @@trueriver1950▽F= μ_0 c J. Maxwells equations with the laws as 0-, 1-, 2-, 3-vector components

    • @polyhistorphilomath
      @polyhistorphilomath 3 ปีที่แล้ว +1

      It’s not really a proof of inapplicability. But the Clifford algebra representation is concise if nothing else.

  • @arnoldn2017
    @arnoldn2017 3 ปีที่แล้ว +23

    Quarter ions are nicely wrapped Rodriguez rotations. The only point I see in favor of quaternions is that it is possible to multiply them with a ‘C-O’ quaternion to mathematically align an observation quaternion to a body quaternion for real time applications like on seagoing vessels

    • @platinummyrr
      @platinummyrr 3 ปีที่แล้ว +2

      That's the primary advantage I found when trying to do a 3d rubics cube program. It was frustrating to have traditional naive rotations break in weird ways when you tried to drag parts of the cube. (If you rotated the cube 180* about an axis, then naive rotations would flip the wrong intuitive way because they were being applied wrong). Using quaternions I was able to easily translate the input into the desired motion.

  • @rogierbrussee3460
    @rogierbrussee3460 3 ปีที่แล้ว +6

    So Clifford algebras (which is what geometric algebras are except without the cult of Hestenes) are really useful. For example they are fundamental for the notion of spinor. In particular |H = Cl(|R^2, Q) where Q is negative definite inner product.
    But there is nothing strange about the Quaternions. Them being 4 dimensional comes from the space of all rotations SO(3) being 3 dimensional and its universal cover Sp(1) being a 3-sphere. Of course a 3-sphere naturally sits in a 4 dimensional space: exactly the three sphere of unit quaternions.
    It works as follows. The space of imaginary quaternions Im(|H) = {v\in |H | v = x I + yJ + z K} is clearly a 3D space with
    v\bar v = x^2 + y^2 + z^2
    the standard inner product. let
    Sp(1) = { q \in |H | ||q|| = q \bar q = 1}
    Then Sp(1) is obviously a 3-sphere. Note that the Lie algebra sp(1) consists naturally of the quaternions h such that
    (1 + \epsilon h) (1 + \epsilon \bar h) = 1 + \epsilon ( h + \bar h) + O(\epsilon^2) = 1 + O(\epsilon^2)
    i.e. h \in Im(|H).
    Moreover Sp(1) acts on Im(|H) by
    v --> q v \bar q
    This is an orthogonal transformation of Im (|H) since
    \bar (q v\bar q) = q \bar v \bar q = - q v \bar q
    and
    q v \bar q \bar(q v \bar q) = q v (\bar q) q \bar v \bar q = q v \bar v \bar q = ||v||^2 q \bar q = ||v||^2
    In fact it defines a rotation because Sp(1) is connected so the determinant of v --> q v \bar q which can only take on the values ±1 must be constant 1. This explains how quaternions give rise to rotations, and clearly q and -q give rise to the same rotation.
    (1 + \epsilon I), (1 + \epsilon J) and (1 + \epsilon K) as a matrix on Im(|H) and keep the first order terms e.g.
    (1 + \epsilon I) I (1 - \epsilon I) = 1 +\epsilon [I, I] + O(\epsion^2) = 1 + O(\epsilon^2)
    (1 + \epsilon I) J (1 - \epsilon I) = 1 + \epsilon [I, J] + O(\epsilon^2) = 1 + 2\epsilon K + O(\epsilon^2)
    (1 + \epsilon I) K (1 - \epsilon I) = 1 + \epsilon[ I, K] + O(\epsilon^2) = 1 - 2\epsilon J + O(\epsilon^2)
    lie algebra element I corresponds to the matrix
    1 0 0
    0 0 2
    0 -2 0
    Proceeding similarly for J and K we see that sp(1) --> SO(3) is an isomorphism.
    The map Sp(1) --> SO(3) is then open, and since Sp(1) is compact it is also closed, so the image of Sp(1) is a closed and open subgroup of SO(3) which must be everything.

  • @realcygnus
    @realcygnus 10 หลายเดือนก่อน

    Some rather interesting comments ! I'm not even going to pretend that I'm qualified to add anything useful here but, I will say that I'm grateful for those who took the time & effort to understand this stuff. & especially for those who actually came up with it in the 1st place, as well as anyone who attempts to teach it.

  • @JohnTan
    @JohnTan 3 ปีที่แล้ว +34

    8:17 Just to clarify, the vector given by cross product is not a "confusion". It is a result of Hodge duality in the exterior algebra. Aka the hodge dual of x is exactly y^z and so on.

    • @user-hh5bx8xe5o
      @user-hh5bx8xe5o 3 ปีที่แล้ว +7

      That's true but the cross product is only relevant in 3D as the dual of a bivector is of dimension n-2 so only mapping vectors to vectors when n is 3.

  • @gnramires
    @gnramires ปีที่แล้ว +1

    I think this would benefit from deriving rotors of an axis-angle rotation. (I think insight sometimes comes from connecting many viewpoints, not just a single one), I found that missing after describing rotors from reflections. But rotors do seem quite compelling, as well as GA as a whole! Thanks.

  • @anthonypace5354
    @anthonypace5354 ปีที่แล้ว

    What helped me understand what was going on “under the hood” with quaternions, was learning that Hamilton was studying a great deal about systems of longitude and latitude. Rotate on one edge by latitude, then rotate by longitude, and you apply a scalar. Also gimbal lock is entirely avoidable, if you learn to rotate from stored positions of origin.

  • @andrey730
    @andrey730 ปีที่แล้ว

    That was a mind blowing presentation, done in incredibly thoughtful and complete way, it does make it click. Would like to see more from you if there will be a chance.

  • @trueriver1950
    @trueriver1950 3 ปีที่แล้ว +2

    The case for quarternions in mechanical motion is greatly enhanced by special relativity, because throughout SR time and space turn up squared but with opposite signs.
    One approach is to just write the formulae with three minus signs.
    Another is to always multiply times by ic (the square root of minus one times the speed of light).
    The most elegant solution is to bundle the "imaginaryness" into the spatial coordinates giving quarternions where the real component of time-distsnce (or of energy-momentum) is time (or energy) and the three imaginary components represent the three spatial components the spatial separations (momentum).
    This produces a delightfully simple version of the otherwise complicated expressions that relate how a moving and stationary observer respectively measure energy momentum, spatial separations, time differences.
    As seen from a moving observer, the transformed values are simply a rotation in a plane containing time and one spatial direction. The maths looks identical to any other rotation.
    If you never intend to incorporate relativity into your physics then I agree rotors make more intuitive sense than quarternions.
    But I have never seen the same represented using rotors.
    Until I do, I am not convinced it is possible, and therefore in my mind there remains a place for quarternions, even if that place is not in the coding of gaming engines and virtual reality.

    • @user-hh5bx8xe5o
      @user-hh5bx8xe5o 3 ปีที่แล้ว +4

      Check en.m.wikipedia.org/wiki/Spacetime_algebra for a treatment of space time with geometric algebra

    • @SpaghettiToaster
      @SpaghettiToaster 3 ปีที่แล้ว +4

      "Until I do, I am not convinced it is possible, and therefore in my mind there remains a place for quarternions, even if that place is not in the coding of gaming engines and virtual reality."
      They're isomorphic so clearly it must be possible.

    • @blinded6502
      @blinded6502 2 ปีที่แล้ว +2

      Bruh. There's a literal branch of spacetime algebra in geometric algebra, that does exactly that.

    • @person1082
      @person1082 2 ปีที่แล้ว

      lorentz transformations can be expressed as a single rotor

  • @blinded6502
    @blinded6502 2 ปีที่แล้ว

    After a year, I finally can say that this article shows geometric algebra from a very weird perspective. It simply attempts to find the appropriate algebra for what it's trying to do, instead of explaining it from bottom up.
    GA actually is all about reflections. When we reflect something twice along different vectors, we can rotate said object. If those reflections are offset, we can translate objects.
    Geometric product combines two or more reflections into a single transformation. Inner and outer product are just cases of geometric product, when only reflections parallel/orthogonal to each other are considered. In first case reflections are cancelled out, in second one they are accumulated into multiaxial reflections.
    That was a rough explanation of how GA works. It's truly an amazing tool, and a very intuitive one at that. It had simplified all of sophisticated linear algebra problems I've had to very tiny equations with very transparent logic.

    • @user-hh5bx8xe5o
      @user-hh5bx8xe5o 2 ปีที่แล้ว

      Actually, while the sandwich product make it easy to work with reflections in GA, the geometric product is more subtle as it involves a change in the dimensionality of the objects it acts on.
      For example, on vectors, it collapses to a scalar AND raises to a bivector. Thus seen functionally the action of the geometric product is quite different from a reflection.

    • @blinded6502
      @blinded6502 2 ปีที่แล้ว

      @@user-hh5bx8xe5o Sum of scalar and bivector is a rotor (a bireflection).

    • @angeldude101
      @angeldude101 2 ปีที่แล้ว

      @@user-hh5bx8xe5o The geometric algebra _composes_ reflections. It doesn't directly _perform_ them. That's the job of the sandwich product. That said, the sandwich product is implemented in terms of the geometric product, so it effectively gives a transformation that first performs one, then another, and then undoes the first transformation, leaving only the result of the middle transformation, but as though it was transformed by the outer transformation.

  • @IElial
    @IElial 3 ปีที่แล้ว +1

    Nice video ! I feel like I am still unaware of more and more stuff the more I learn new one. I heard of quaternion reading of book about DirectX 9 back in the days, without totally understanding it beyond that it is better because it solve gimbal lock. And now I discover there was a whole algebraic side developped end of 19th Centurty as a better Quaternion solution !

  • @moonmakesmagic
    @moonmakesmagic 3 ปีที่แล้ว +1

    I'm still using quaternions because, well, existing APIs, but this was very well explained and helpful

  • @LAK132
    @LAK132 4 ปีที่แล้ว +7

    Hi, thank you for this video! I'm looking through your code, and I'm having a hard time working out how you came up with this implementation. I see the trivector value in there, but I can't work out how that comes out of the bavab equation?

    • @marctenbosch
      @marctenbosch  4 ปีที่แล้ว +7

      You have a rotor that is r=a*b, then you first multiply v by r, that gives a vector + trivector, then you multiply the result of that by reverse(r) and that kills off the trivector part.

  • @philkaw
    @philkaw ปีที่แล้ว

    What makes quaternions special is that they’re one of the four composition algebras (the real numbers, the complex numbers, the quaternions and the octonions) and their automorphism group is exactly SO(3).

  • @erickweil4580
    @erickweil4580 4 ปีที่แล้ว +4

    Also, how is the geometric product generalized to 4D when you have Bivector x vector? from my calculations it produces a vector plus four trivector parts. Those trivector parts can be dropped out? my Geometric Algebra understanding only was able to make 3D Rotors work.

    • @erickweil4580
      @erickweil4580 4 ปีที่แล้ว +1

      After doing some math, actually those trivector parts are used in the second multiplication of the rotation sandwitch. I'm not sure if its 100% correct but it worked so far. Thanks for this video and article.
      In a future article you could talk a little bit about Rotors is in 4D, is not that trivial.

    • @marctenbosch
      @marctenbosch  4 ปีที่แล้ว +1

      The trivector part drops out when doing the full sandwich product, yes.

    • @erickweil4580
      @erickweil4580 4 ปีที่แล้ว +1

      @@marctenbosch To solve it I ended up doing a program that expands the geometric algebra expressions following the rules and then getting only the final reduced formula(used python and the library sympy)
      So rotor multiplication and matrix conversion worked perfectly.
      But...
      I found some problems while interpolating 4D Rotors, as with some combinations of rotors the result is a rotation with scaling.
      I didn't found any resources about log or square roots of rotors ( also exp is very very slow ) as there is a way to interpolate that requires this calculation (multiplicative interpolation)

  • @JanPBtest
    @JanPBtest 3 ปีที่แล้ว +5

    Mathematicians call it "Clifford algebra" and "Clifford multiplication". I don't know where the terms "geometric algebra" and "geometric product" came from originally. Likewise, the wedge product of vectors is a part of "Grassmann algebra". I agree all this should be taught early on, along the standard vector product (which can be very useful too, it works not only in 3D but as a product of (n-1) vectors in n-D.

    • @kvazau8444
      @kvazau8444 3 ปีที่แล้ว +5

      the term "geometric algebra/product" came from clifford himself.

    • @JanPBtest
      @JanPBtest 3 ปีที่แล้ว

      @@kvazau8444 I wonder why the name did not stick with mathematicians.

    • @MichaelPohoreski
      @MichaelPohoreski 3 ปีที่แล้ว +2

      Jan I'm not sure where you are getting the lie that Mathematicians don't call it Geometric Algebra. Austrian Mathematician Emil Artin has a 1957 book called _Geometric Algebra._

    • @JanPBtest
      @JanPBtest 3 ปีที่แล้ว

      @@MichaelPohoreski I never heard the term "geometric algebra" used in the areas connected to manifold geometry and topology. I'm sure it's used in _some_ areas of mathematics. But then I left academia 20 years ago so perhaps things have changed today.

    • @MichaelPohoreski
      @MichaelPohoreski 3 ปีที่แล้ว

      ​@@JanPBtest The problem is a LOT of math teachers are horrible teachers teaching by rote, suck the passion out of kids, and are ignorant about modern topics such as bivectors, why the cross product only being defined in 3 and 7 dimensions is a problem, don't teach that the imaginary value i = sqrt(-1) is a 90° rotation, etc. This is mostly due to their teachers being uninformed and bad as well.
      You'll want to read Paul Lockhart's _A Mathematician's Lament_ that gives a depressing but accurate summary of the state of teaching mathematics.

  • @Taronites
    @Taronites 3 ปีที่แล้ว +8

    This totally beats any OBE meditation. By the 10th minute I find myself hovering at least 7 inches above my chair. ^^

    • @atomictraveller
      @atomictraveller 2 หลายเดือนก่อน

      seven inches rofl :)

  • @bluceree6897
    @bluceree6897 3 ปีที่แล้ว +13

    Man, I wish i was smart enough to understand any of it and how to properly utilize it in my code :(

    • @galvanizeddreamer2051
      @galvanizeddreamer2051 3 ปีที่แล้ว +10

      Bookmark it, and come back to it after taking an entire course on geometric algebra or something.
      Because you can bet your arse that's what I'll be doing.

    • @MyLittleMagneton
      @MyLittleMagneton 5 หลายเดือนก่อน +1

      @@galvanizeddreamer2051 How'd it go?

    • @galvanizeddreamer2051
      @galvanizeddreamer2051 5 หลายเดือนก่อน

      @@MyLittleMagneton I forgot to do this, and I still can't code.
      I wrote an RPG system tho.

    • @atomictraveller
      @atomictraveller 2 หลายเดือนก่อน

      try this: // init s0 = 1; s1 = 0;; // loop s0 -= w * s1; s1 += w * s1; renormalise the leg every buffer or so

  • @renexmachina
    @renexmachina 3 ปีที่แล้ว +12

    i didn't really understand anything despite a background in videogame graphics, but i feel like my efforts avoiding quaternions all these years have been justified.

    • @Sh-hg8kf
      @Sh-hg8kf 3 ปีที่แล้ว

      As a beginner planning to learn 3d graphics, same XD. Hopefully I can understand this soon enough

    • @SteinCodes
      @SteinCodes 3 ปีที่แล้ว +2

      Clear up your head rewatch it from the outer product part. It will flow quite well. I had started watching the video with too much bias because of the title so had a lot of issues in understanding on first attempt it's extremely simple.
      Basically your cross product gives you a perpendicular vector which adds complexity while you can avoid it by simply using a bivector instead which is an outer product.
      Outer product of same vectors is 0 is an base identity of it, and allows to build other identities required for implementation.
      3D bivectors are slightly confusing as they need understanding of plane projection to get their components but the essence is all the same. But here computer is doing the maths so it's not a concern.
      Otherwise bivectors are the same as cross product in equations just use basis planes instead.
      The best part though is the fact that they can scale infinitely(bi - tri - quad), it's part of multivector algebra. And truth be told I knew about it to some extent just never thought of using it. Search Wikipedia for Multivector and Clifford Algebra on internet.

    • @Sh-hg8kf
      @Sh-hg8kf 3 ปีที่แล้ว +1

      @@SteinCodes What level of math background does one need to understand this video and the topic at hand in your opinion?

    • @SteinCodes
      @SteinCodes 3 ปีที่แล้ว

      @@Sh-hg8kf Whatever level I am at, so around a little more than High School. Or a few years of experience writing/working game engine rendering source.
      For the purpose of brevity anyone who graduated with Maths as a subject in college.

    • @Sh-hg8kf
      @Sh-hg8kf 3 ปีที่แล้ว

      @@SteinCodes How would one tackle this prior to finishing high school math? Linear algebra was barely taught here, with a brief explanation of matrices, steps of matrice multiplication given without intuition and determinants to give a perspective. Any stuff I should cover on top of these (I am a bit decent with the multiplication intuition now)? Since our syllabuses might be diff, idk how much stuff matches up.
      Also, wait, if a engine dev with years of experience can understand this, most normal starting-out game devs would find this hard and thus not have to implement stuff like this and quaternions?

  • @ChrisDjangoConcerts
    @ChrisDjangoConcerts 3 ปีที่แล้ว +1

    Very good video ! I learned new things while already familiar to the subject Good job Marc !

  • @AndrewJonkers
    @AndrewJonkers 3 ปีที่แล้ว +1

    Very nice. I had the same questions about quaternions that you did regarding dimensionality.

  • @petrowi
    @petrowi 4 ปีที่แล้ว +7

    I'm very eager to see these 4D rotations and movement in Miagakure, is it coming out?

  • @PhantomKING113
    @PhantomKING113 3 ปีที่แล้ว +4

    I knew it! The multiplication table at 12:10 looked familiar, and that's for a simple reason: since rotors and quaternions are isomorphic, there's no way to run away from them.
    Basically, rotors use 2 leters for the same thing for which a quaternion uses 1; though idk how to emulate vectors with quaternions, I am not a mathematician...
    Let's say xy is like i, and yz like j, then xz is like k and we get the following multiplication tables:
    \ *1 xy yz xz*
    *1* 1 xy yz xz
    *xy* xy -1 xz yz
    *yz* yz xz -1 xy
    *xz* xz yz xy -1
    So it's just quaternions again.
    As for the other table:
    \ *1 x y z*
    *1* 1 x y z
    *x* x 1 xy xz
    *y* y xz 1 yz
    *x* z xz yz 1
    In quaternions, that probably also has some representation, but I am not a mathematician or anything like that so I'ma stop here before I get something wrong.
    Anyway, cool video!
    Also, the quaternion multiplication table doesn't come out of nowhere, there's logic to it...
    Edit:
    Btw, 3D rotors are also 4-dimensional, so don't get confused. If you represent the xy component on the z axis, the yz component on the x axis and the xz component on the y axis, you still need a fourth axis for the scalar part (if that was how it was called). So no, rotors aren't any simpler, they just favour a different angle from which to approach the same overall mathematical system.

    • @angeldude101
      @angeldude101 3 ปีที่แล้ว +1

      The 4th component is the scalar-part, correct. It can also be called the 0-vector or grade-0 vector since it's a product of 0 basis vectors.
      From what I understand, quaternions were originally conceived as the quotient of two vectors, so your second table is probably not far off from how Hamilton defined them since the inverse of a vector in GA is just the vector scaled to the reciprocal of its length, which for the basis vectors is just themselves. The biggest problem is just that it's never mentioned when initially teaching quaternions, while bivectors have a clear relation to the vectors that formed them.

    • @blinded6502
      @blinded6502 2 ปีที่แล้ว +2

      Actually, considering the fact that quaternions are usually constructed from rotation-axis pseudovector:
      i = yz
      j = xz
      k = xy
      3d rotors are not 4d. I mean, you could represent them as 4 quantities along 4 different axes, but.... Why?

  • @roygalaasen
    @roygalaasen 4 ปีที่แล้ว +8

    I am confused. Not by your excellent video, but because I was already subscribed to your channel. That means there were excellent videos here from before. But this is the only video here and it was released 30 minutes ago. Did you delete all of your old content? That is a bit sad because although I don’t remember it off the top of my head, I did subscribe because it was good, and if it is deleted, good content has been taken away from this world.

    • @ddegn
      @ddegn 4 ปีที่แล้ว +1

      I initially felt like you described. I checked out his website and felt a bit more at ease. There's lots of great stuff on his website.
      Apparently this is an update of an older video. I also don't recall how many videos he had, I just remember being impressed by the quality of the previous video.

    • @roygalaasen
      @roygalaasen 4 ปีที่แล้ว +1

      Duane Degn if I remember correctly, this is the channel I commented that it was sad that he didn’t make any more videos since they were few, but really good and his last video was like 3 years ago or something. In that case we are in for a lot of goodies coming up in the future.

    • @ShankarSivarajan
      @ShankarSivarajan 4 ปีที่แล้ว +4

      This is the Miegakure guy. That's almost certainly why you were subscribed.

    • @roygalaasen
      @roygalaasen 4 ปีที่แล้ว +1

      Shankar Sivarajan oh it is? I am certain that was not the reason, but I subscribe to loads of math channels and also watching a few videos of that game, TH-cam algorithm probably thought to suggest videos from this channel, and I took the bait and subscribed. Thanks for the connection though!

    • @marctenbosch
      @marctenbosch  4 ปีที่แล้ว +4

      My other videos are unlisted, they are old and I embed them on the related articles on my website.

  • @ObsessiveClarity
    @ObsessiveClarity 3 ปีที่แล้ว

    7:13 I've been looking for this visualization for some time. Thank you.

  • @samisiddiqi5411
    @samisiddiqi5411 4 ปีที่แล้ว +3

    Curiously, what does the fourth dimension mean for motion in quaternions?

    • @FiremarkPl
      @FiremarkPl 11 หลายเดือนก่อน

      ijk dimensions are for "heading" of the object and fourth dimension is for rotation around the ijk vector. Btw this is funny: en.m.wikipedia.org/wiki/Axis%E2%80%93angle_representation

  • @infinummjb
    @infinummjb 3 ปีที่แล้ว +4

    OMG, this is brilliant! So coherent and intuitive - love it!

  • @mathunt1130
    @mathunt1130 ปีที่แล้ว

    Geometric algebra is a very beautiful area of modern mathematics. I should be taught on all undergraduate courses.

  • @danielb270
    @danielb270 3 ปีที่แล้ว +1

    The reason Quaternions are used is because they can be computed and represent as a 4x4 matrix - matrix addition and matrix multiplication is what GPUs specialize at.
    ALL 3D graphical 3d applications use a single 4x4 matrix to represent position, rotation and scale. And it is used to perform screen projection.
    One way or another to represent rotation inside the engine quaternions are the optimal solution as it costs a single matrix addition.
    If you want you can create whatever wrapper level you want, but at the end YOU MUST provide 4x4 matrix to the GPU for rotation (unless you develop a new hardware architecture, graphics API, and with a better performance)

    • @joeedh
      @joeedh 3 ปีที่แล้ว

      GPUs are SIMD (single instruction multiple data) machines. They don't require 4x4 matrices per se. Some engines will work in quaternions for real-time skinning, only using the final camera matrix at the end..

    • @danielb270
      @danielb270 3 ปีที่แล้ว

      @@joeedh they don’t require 4x4 matrices, but they have hardware specifically for those operations

    • @blinded6502
      @blinded6502 2 ปีที่แล้ว

      Quaternions are rotors. They are literally rotors, but they are named wrong. And because people don't understand how do they work (in terms of GA behind it), they can't fully utilize them. And there's a ton of features that GA framework provides.

  • @dakotapearl0
    @dakotapearl0 3 ปีที่แล้ว +2

    Really interesting! It's like quaternions are a simplification of this concept. What I'm trying to figure out is if the implementation of rotors in a 3D game engine can be as efficient as quaternions. How much information needs to be stored for each rotation and how many operations need to be done per rotation?

    • @nzuckman
      @nzuckman 3 ปีที่แล้ว +7

      Quaternions are an even subalgebra of the Cl(3) geometric algebra - if you throw out the vectors and trivectors, you're left with scalars and bivectors whose algebra is exactly the same as the quaternions. They contain the same information, although a geometric algebra has *slightly* more overhead because it has the vectors and trivectors too - however, the intuitive understanding gained from this is well worth it.

  • @peterwilson69
    @peterwilson69 3 ปีที่แล้ว +2

    I built my own 3D engine from scratch and never needed Quaternions; I could solve every problem I needed without them. I built my own flight simulator with advanced camera control system able to view from outside the aircraft, in cockpit and ability to fly around, all while the aircraft was doing it's own thing. Never had a problem.

    • @porky1118
      @porky1118 3 ปีที่แล้ว +2

      Do you have gimbal lock and just don't have a problem with it?
      Would it be easy to make your simulator work around a planet?

    • @asdfghyter
      @asdfghyter 3 ปีที่แล้ว

      How do you avoid running into issues at the poles without quaternions? Like rotations around the, x/y/z axes? Or are you using something equivalent to quaternions?

    • @peterwilson69
      @peterwilson69 3 ปีที่แล้ว

      @@porky1118 Gimbal lock occurs when you let a user “look down” the UP axis. So just rotate the UP axis when they start looking at it. Ie. Rotate the entire reference frame. If you nest reference frames, then you easily and simply mimic the behaviour of quaternions, while still using easy to understand transformation matrices/maths.
      If you are tasked with making a pilot look out a window in the direction of flight, while flying in a different direction, while allowing their pilot seat to be moved at the same time as plane is banking taking into account the curvature of the Earth the plane is flying over, then all these nested transformations become trivial and fast, and more importantly for a programmer, easier to debug, extend or change behaviours. Ie. Do all the above, but add a virtual camera following near the aircraft, that keeps the plane in view, while also tracking an incoming missile (to increase drama and let this virtual viewer see the drama unfolding from a unique perspective) Adding all these transformations is easier without worrying about quaternions. Don’t be bullied by others into making you believe you need them - you don’t! There’s more than one way to do things. Plus, the more advanced your camera system is, the more options you have for a user never “wanting” to look down the UP vector. Make it boring to look at, never let the user even rotate their point of view “to” a gimbal lock situation. Allow them to get close (if they insist) but never fully locked. Always make the user look at a dummy object, but position this dummy object in such a way it helps guide the experience for a user. Sorry, could talk forever.

    • @peterwilson69
      @peterwilson69 3 ปีที่แล้ว

      @@asdfghyter yes, very trivial to fly anywhere around a planet. But you must learn to nest transformations, and be able to write them out to help debug or plan. Ie. Pilot head (ie the camera) = Earth surface location transform * Aircraft_Location * Adjustable_seat_position_within_aircraft * Orientation_of_pilots_head.
      camera = earth * aircraft * seat * look
      Each multiplication step is a 4x4 matrix. The result is a 4x4 matrix which then gets applied to all geometry (landscape, aircraft, flight attendants walking down aisle etc)
      You can nest these transformations as deep as you want without paying any penalty in terms of speed.
      Each transform has a gimbal lock, the pilot sitting in his pilots seat, can still have gimbal lock if he looks directly UP at the cockpit ceiling.But there’s ways to avoid this simply by directing his attention “close to up” with a bias of looking forward towards towards the cockpit window. Or, just rotate where UP actually is, which then fully mimics quaternions, but then won’t be as intuitive for a user experience. I would urge you to perform simple experiments in nesting transforms.

    • @blinded6502
      @blinded6502 2 ปีที่แล้ว

      Just... Use geometric algebra please. It simplifies a lot of things. A lot. Of things.
      Interpolations it generates are absolutely perfect, and derivations with it's use only take a line or two of code.
      If you need me to, I could explain GA in layman terms.

  • @losiu998
    @losiu998 3 ปีที่แล้ว +3

    6:51 - B_xy looks like determinant of the 2D matrix, where columns are 2D vectors, coincidence? Of course not :)

  • @zaq1320
    @zaq1320 3 ปีที่แล้ว +5

    This is great! Some really cool vector math I didn't know about. So, while I have no doubt that these work, I'm struggling to understand how they would serve artists better in a 3D program. The math being prettier under the hood doesn't mean much if it doesn't actually improve the production process, and I can't actually tell exactly what implementing these with all degrees of freedom would look like. Say your A vector is just fixed to some arbitrary unit axis (of the artist's choice). Makes sense. The artist now has to define another point in 3D space, with three numbers we can then normalise to the B vector. Great. I struggle to understand how this doesn't just amount to a "swing" rotation, which we then add a "twist" rotation to afterwards.
    Swing and twist rotations are already implemented in blender (not sure about maya), and are very useful - if that's what an implementation of rotors shakes out to, then we already have 'em, although only in the drivers. They're great! They are computed from quats, though. If rotors kind of naturally decompose to swing and twist that's convenient for the developers, which is nice I guess. For an artist I don't imagine it would make too much of a difference.

    • @JivanPal
      @JivanPal 3 ปีที่แล้ว +2

      *_"I'm struggling to understand how they would serve artists better in a 3D program."_* - It doesn't, that's the whole point of the video. Quaternions work just fine, and the author points out that they are isomorphic to rotors. That is, they're functionally one and the same. The point of considering rotors is that they are more intuitive to work with. It's a mathematician's interest, not a software engineer's. If you were to implement both quaternions and rotors in code, the implementations would be equivalent.
      If, as a programmer, you are working with a physics library that implements its functionality with either quaternions or rotors, but abstracts that away from you via an API that makes no mention of either, then the underlying math is not a concern. However, if you are working directly with quaternions or rotors, then the latter is most likely favoured, because they are easier to intuit about.

    • @zaq1320
      @zaq1320 3 ปีที่แล้ว +1

      @@JivanPal Yeah, I figured it seemed like a purely mathematical/software engineering exercise and again, from a back end perspective this is really cool. The title does say we should remove quaternions from every 3D engine, though, I think it’s not unreasonable to infer a claim about improving the work of 3D engine users from that, right? I’m just always on the look out for better ways to handle rotations as a technical artist.

    • @JivanPal
      @JivanPal 3 ปีที่แล้ว +4

      @@zaq1320 *_"The title does say we should remove quaternions from every 3D engine, though, I think it’s not unreasonable to infer a claim about improving the work of 3D engine users from that, right?"_* - Ehh, semi-clickbait. Seems to me like the author is merely advocating that such a change should take place because computer physics/graphics courses should be teaching students about rotations from the rotor perspective rather than the quaternion perspective, in order to aid intuition and understanding as to what these things are and why they work.
      *_"I’m just always on the look out for better ways to handle rotations as a technical artist."_* - You're probably not going to find it! The APIs and optimised hardware already exist, nothing better will appear (at least not anytime soon; mathematics has pretty much got this area covered already).

    • @joojaa3927
      @joojaa3927 3 ปีที่แล้ว +3

      For an artist this gives a way for you to better visualize the rotation. Not well but better. This in turn means that we can eventually work out a more workable way of controlling the rotation with animation curves. Since eventually the visualisation will lead to a understanding. Theres no way you can directly manipulate the quaternion values in a meaningful way.
      In addition its hard to work with quaternion in physics context. So that could mean better user interfaces for inverse simulations. Inverse simulations would allow us to have better controllable simulations in conjunction to keyframes.
      But ultimately having more of your programmers actually understand the math gives ground for more tools, more tries and better successful tools for you to use.

    • @joeedh
      @joeedh 3 ปีที่แล้ว +1

      @@JivanPal Honestly I'm not convinced that either approach is particularly intuitive. I don't care if geometric algebra makes more sense in >3 dimension, for 3d it seems to add complexity without value.

  • @daveyhu
    @daveyhu 2 ปีที่แล้ว +1

    Is there a preferably c++ library out there implementing these rotors where one could see them in action and most importantly assess the performance characteristics of working with them over quaternions?

    • @marctenbosch
      @marctenbosch  2 ปีที่แล้ว +1

      See the source code attached to the article: marctenbosch.com/quaternions/code.htm

    • @blinded6502
      @blinded6502 2 ปีที่แล้ว

      There are quite a few libraries like that on the Bivector website

  • @sumdumbmick
    @sumdumbmick 3 ปีที่แล้ว +40

    as a general rule when the people around you are all dogmatically saying the same thing and nobody can explain why, it is more than legitimate to question it.

    • @michaeltsouris8190
      @michaeltsouris8190 3 ปีที่แล้ว +11

      if you're surrounded by people who can't explain something that is well documented, you're asking the wrong people.

    • @ericy1817
      @ericy1817 3 ปีที่แล้ว +1

      @thatonespathi Sometimes these things honestly just fall to convention. Both pi and tau have their merits, its just that people started using pi first so we stuck with it.

    • @danielb270
      @danielb270 3 ปีที่แล้ว +1

      Any Computer Graphics Course (the coding kind) in University should explain it.
      Also, super-short answer: that is how GPU's work, so ANYTHING else would be slower.

    • @omp199
      @omp199 3 ปีที่แล้ว

      @@ericy1817 I am unaware of any merits to using pi rather than tau, other than that all the works of reference already use pi.
      Also, there are all these people talking about quaternions here, but I can't see any mention of why they were a thing in the first place.
      The Wikipedia article sums up why quaternions are a thing: in 1877, Ferdinand Georg Frobenius proved that for a division algebra over the real numbers to be finite-dimensional and associative, it cannot be three-dimensional, and that there are only three such division algebras: the real numbers, the complex numbers and the quaternions, which have dimension 1, 2, and 4 respectively. That's what makes them special.

  • @nietschecrossout550
    @nietschecrossout550 3 ปีที่แล้ว +1

    Are there any benchmarks on what can he computer faster? 4D 32bit floating point numbers smell of superscalar optimisation, do they not? To the best of my knowledge with a length 3 vector youll end up with 4 byte of wasted memory on your GPU per operation.

    • @JivanPal
      @JivanPal 3 ปีที่แล้ว +2

      It sounds like you're advocating the use of 3D vectors rather than either quaternions _or_ rotors. If that's the case, you need to realise that the whole reason quaternions are used in computer physics in the first place, rather than 3D matrix algebra, is that matrix algebra suffers certain problems (such as gimbal lock when interpolating rotations) that the former overcomes.
      As for computational time/complexity, there is not much overhead. Multiplication is fast, and these days we have ICs expressly designed to do this kind of computation as fast as possible. That's what in your GPU. As for memory, consider that power-of-2 multiples of allocated memory are generally preferred because of chip/DIMM design. That is, if I have a 3D vector data structure comprising three 32-bit numbers, it is likely that when I instantiate multiple instances of it, they will be aligned on 64-bit or 128-bit boundaries rather than 32-bit boundaries anyway, so you don't actually save any memory from a practical standpoint.

  • @khatharrmalkavian3306
    @khatharrmalkavian3306 3 ปีที่แล้ว +3

    Ahh... Math and quaaludes. Great combination you've got going here.

  • @AkamiChannel
    @AkamiChannel 2 ปีที่แล้ว +1

    Can bivectors be used for smoothly interpolating rotations?

    • @angeldude101
      @angeldude101 2 ปีที่แล้ว +1

      Yup! For the same reasons that quaternions are good for spherical interpolation.

  • @OriginalJetForMe
    @OriginalJetForMe 3 ปีที่แล้ว

    This is really great. I’m tempted to implement this and see if I can make it use SIMD.

    • @AkamiChannel
      @AkamiChannel 2 ปีที่แล้ว

      I think others have done that already!

  • @jakubscholtz3320
    @jakubscholtz3320 3 ปีที่แล้ว +7

    Just wait for the moment you realize that in 3d bi-vectors are related through Hodge dual to the vectors and this whole video was about being surprised this isomorphism exists :-)

    • @zzasdfwas
      @zzasdfwas 3 ปีที่แล้ว +2

      He says pretty early on that it's isomorphic.

  • @thygrrr
    @thygrrr ปีที่แล้ว +1

    Thank you for this great perspective, but especially in the middle, I fail to connect the dots and have no mental model whatsoever of your bivector, numerically. I always thought it is the cross product.
    I think you could have provided the actual formula for the bivector for the 3D case. Numerical only, default unit basis in 3 dimensions ("xyz", or index 1 to 3, or 0 to 2 for us coders).
    Is it the cross product in 3d now, or IS IT NOT? Your formula looks like it's self referential, each outer product requiring another outer product multiplied with the components of the cross product. 7:56 How do we even read the bottom equality? Or is it a formatting error and the wedge products on the right side are subscripts?
    And which one do we use? It appears like this depends on the handedness of our coordinate system but you just skipped over it. 😢 Or is the first + in the bottom equation at 7:56 a typo?
    From the looks of it, it's also not clear whether trig functions are needed for this wedge notation or not. Can I express a definitive rotation from a into b (around the axis axb) without first calculating the angle 2alpha, just by using the two unit vectors a and b?
    As it stands now, I find the exponential map / quaternion representation of rotations more intuitive, and that's really saying a lot.

  • @syirogane
    @syirogane 9 หลายเดือนก่อน

    I think this needs a follow up video: "Let's remove arrows from every 3d engine: an introduction to plane-based projective geometric algebra"

  • @Alexander_Sannikov
    @Alexander_Sannikov 3 ปีที่แล้ว +1

    I don't see an explanation of how exactly you define a geometric product, and more specifically, how do you add its scalar part with its bivector part. Because if you define geometric product as an operation that acts on two vectors and produces a scalar + bivector, how do you later claim that reflection is R(v, a) = v - 2*(v*a)a = ava, where you have a vector on the left side of the equation and a (bivector+scalar)*vector=trivector on the right side?

    • @user-hh5bx8xe5o
      @user-hh5bx8xe5o 3 ปีที่แล้ว +4

      In the video, the geometric product is defined on vectors by splitting it into the symmetric part and antisymmetric part. The first is identified with the dot product and the second with the exterior product.
      Note that conceptually, the geometric product on vectors is the sum of a contraction (the output has a lower dimension than the inputs) and an extension (higher dimension than the input).
      In practical terms, the geometric product can be computed from the relationships of the basis vectors. In the Euclidean case described in the video, a vector multiplied by itself is 1 and multiplied by any other basis vector is 0 (Kronecker's delta). Other elements (bivectors, trivectors, ...) products can be computed by the rules on vectors and the antisymmetry of the basis bivectors (e1*e2 = - e2*e1) which allows to swap terms to cancel duplicates (e2*e1*e2 = - e2*e2*e1 = - e1).

    • @stefanvasilev2013
      @stefanvasilev2013 3 ปีที่แล้ว

      A valid remark. As already noted, it's defined as a sum but the sum is between different entities. To make that valid you need to introduce another space where both entities live, which was not done in the video, losing rigorousness. Another miss was the lack of proof why this product is invertible, there were only (questionable) heuristics. Describing the whole thing consistently would've been more work than just explaining how to use quaternions in a clear way, so it would've defeated the purpouse of the video I guess :)

  • @satarimar
    @satarimar 3 ปีที่แล้ว

    this is how I understand quaternions:
    1) quaternions can be represented as a 4 component vector, where q and -q represent the same rotation; quaternion representing a rotation is a 4d vector of size 1, unit quaternion is 0,0,0,1
    normalization is as trivial as normalizing a 4d vector
    so instead of a+b*i+c*j+d*k (a,b,c,d) I use x(b), y(c), z(d), w(a)
    2) xyz represents scaled axis around which you rotate and w encodes the amount, like this: (x,y,z) = normalized axis * sin(angle/2), w = cos(angle/2)
    not hard to guess why this representation is useful and how it's trivial to do axis-angle with quaternions
    in fact extracting axis, angle from a quaternion is as trivial except for the singularity of unit quaternion - where any axis will do
    3) inverse transform (complex conjugate) is as simple as -x,-y,-z,w, i.e. negating the encoded axis of rotation
    4) quaternions can be encoded as a 3-component vector (if you don't mind one sqrt to reconstruct w), packing simply requires to make sure w is not negative (=negate 4d vector if needed, strip w, reconstruct later)
    5) quaternions can be easily (n)-lerped (just make sure their dot product as a 4d vector has the same sign, then lerp and normalize just like a 4d vector
    6) forget about transforming a vector by q*(v,0)*qinv, there's a faster way using two cross products (reference: blog.molecular-matters.com/2013/05/24/a-faster-quaternion-vector-multiplication):
    t = (q.xyz x v) * 2
    v' = v + t*q.w + (q.xyz x t)
    7) angular velocity (say O) is represented as rotation axis times magnitude (times dt), so it can be easily applied to quaternion q (details here arxiv.org/pdf/1604.08139.pdf):
    t = (O, 0) * q (note that this is quaternion multiplication)
    q' = q + t/2
    8) conversions to/from 3x3 matrix can be found online, just watch out for chirality when extracting from a matrix (mrelusive.com/publications/papers/SIMD-From-Quaternion-to-Matrix-and-Back.pdf)

    • @blinded6502
      @blinded6502 2 ปีที่แล้ว

      Quaternions are a rotor. Rotor is a bireflection along two vectors.

  • @edomeindertsma6669
    @edomeindertsma6669 3 ปีที่แล้ว +1

    11:42 that 'property bundle' reminds me of quaternions.

  • @doce7606
    @doce7606 3 ปีที่แล้ว

    Perhaps an adjoint to re-imagining continuum mechanics after Koenman. Plus, a prompt to scrap baffling inverse and transpose vector operations to describe simple planes and volumes. But as a simpleton myself, can i just check the relation with (aa bb) diads? Also, can you show this in spherical coordinates...?

  • @Garfield_Minecraft
    @Garfield_Minecraft 20 วันที่ผ่านมา +1

    this makes much more sense

  • @MarkKrebs
    @MarkKrebs 6 หลายเดือนก่อน +1

    I guess I'll pitch a monkey wrench at this. I *love* quaternions. When you have a rotation, thinking of the two-d case (where Bosch begins) the axle about which the rotation happens lies in the third dimension. In this way it's not too unnatural to imagine that 3-d rotations might need 4 elements to describe them. Quaternions anticipated the mathematics of vector calculus eg Maxwell's equations and aerodynamics and quantum mechanics etc etc. Don't be scared off too easily, quaternions are great.

  • @GamingKing-jo9py
    @GamingKing-jo9py 11 หลายเดือนก่อน +1

    7:43 marc PLEASE fix this. this has been confusing me for years you should make the y for the cross product as (-y) removing the y up front. otherwise it looks arbitrarily different. either change that base to -y or flip the bivector x∧z to z∧x. it makes the connection so much clearer, and stops another soul from looking at countless wiki articles trying to find why the negative and why everyone is saying they're exactly the same

  • @lazerpie101
    @lazerpie101 ปีที่แล้ว

    where does the 'a' in a 3D rotor come from?
    edit: after skimming the comments in the code, it is the rotation around the bivector defined by the latter 3 elements.

  • @angeldude101
    @angeldude101 ปีที่แล้ว

    True, there is only one plane in 2D to rotate within, however there are also infinitely many points in 2D to rotate around, unless you're restricting yourself to rotations around the origin, in which case the origin itself is the only point to rotate around. Also who said anything about rotating around a line? 2D lines are mirrors, not rotation axes.
    Extending to 3D, which this does give back the idea of an "axis of rotation" (which _is_ a line when in 3D), I'd still argue that they're more clear than quaternions since the direction is still encoded in how you write the basis: xy, yx, yz, or zy instead of i or -i.

  • @geoffreystearns1690
    @geoffreystearns1690 3 ปีที่แล้ว +1

    Can rotors be orthogonalized? Due to the discrete nature of digital computing, quaternion orthogonality will drift over time as their components get truncated in computation. They therefore have to be reorthogonalized after a while for precision results. Are rotors subject tot he same problem?

    • @JivanPal
      @JivanPal 3 ปีที่แล้ว

      Of course, because the problem you're describing is one of computer precision, not underlying mathematics. Rounding errors are a problem in every aspect of computational mathematics. Re-orthogonalisation is just checking and enforcing a constraint over time (in this case, that the angle subtended is 90°) to make sure that rounding errors don't compound too much.

    • @areadenial2343
      @areadenial2343 3 ปีที่แล้ว

      While a bit far off, computers using balanced ternary instead of binary computation could be useful for this. In balanced ternary, truncation is the simplest way to round to the nearest number, so rounding errors accumulate much more slowly.

  • @oliverbroad4433
    @oliverbroad4433 3 ปีที่แล้ว +1

    Years ago I tried playing around with quaternions in Gamemaker. There were 3D commands for pitch, yaw, roll and rotate around a vector, so I started out with a clunky euler-angle implementation. After some time I realised the imaginary parts could be treated as a rotation axis and the rotation angle could be calculated "easily".

    • @blinded6502
      @blinded6502 2 ปีที่แล้ว

      Imaginary parts in 3d form a pseudovector (bivector). Dual of that pseudovector is a vector. And that vector represents an axis of rotation.

  • @chilljlt
    @chilljlt 21 วันที่ผ่านมา

    wow! this was incredible! please make more videos!

  • @Hampardo
    @Hampardo 3 ปีที่แล้ว +4

    Mmmm your video makes me want to learn differential geometry so bad.

    • @HilbertXVI
      @HilbertXVI 3 ปีที่แล้ว +4

      Why don't you? It's so cool

  • @nottellinganyoneanything
    @nottellinganyoneanything 4 ปีที่แล้ว +2

    I just do not see why is this better/different form quaternions. It is a different name for the same thing. Do you have a coded example, where I can see the differences in use (not the implementation or Rotors, for what I saw it is just quaternions with different wordings)?
    One thing I always wanted to to do with quats is to apply a "partial" rotation, something like "take N% of the rotation represented by q1 and apply it to q0". Is this possible with rotors? With quats you basically have to extract the axis and the angle and then contruct a new quaternion.
    Can a rotor represents rotation outside of [0;360deg], for example a 720deg rotation, where I can take N% of it?
    I just don't see why and how this is better then the established quaternions. It is easy to extract the plane and the angle of rotation from a quat. Multiplication and inverses/conjugates are quite easy.
    lerp/slerp-ing them is easy.

    • @marctenbosch
      @marctenbosch  3 ปีที่แล้ว +2

      It's better because rotors don't come out of nowhere like quaternions do. Here's the code: marctenbosch.com/quaternions/code.htm

    • @porky1118
      @porky1118 3 ปีที่แล้ว +1

      Quaternions and 3D rotors are just the same thing. There's nothing you can do with 3D rotors, that you can't do with quaternions by themselves. There are two advantages of rotors.
      1. Rotors are dimension generic.
      So you could write some utility method for rotors in general and it works for rotors of any dimension.
      2. If you also have other GA types like bivectors, rotors show their true power.
      For example you can create a torque by mutliplying two vectors using the outer product and get a bivector, which you use as torque. Then you compute the exponential function of that bivector and get a rotor, which you use to rotate the object. Then you multiply the rotor by another rotor to change the view.
      So rotors aren't that special themselves, but GA is.

    • @nottellinganyoneanything
      @nottellinganyoneanything 3 ปีที่แล้ว

      @@porky1118 Aha, that dimension generic thing is the key. Thanks for the clarification. Maybe If I delve more into physics they will start making sense.

    • @porky1118
      @porky1118 3 ปีที่แล้ว

      ​@@nottellinganyoneanything A simple example in physics, why you would prefer GA is torque (angular momentum).
      In 2D you would probably represent angular speed using a scalar, in 3D you would use an axis vector, where the magnitude represents the velocity.
      In GA, you would just use a bivector. A 2D (x, y) bivector has only one component (xy), so it's similar to a scalar.
      In 3D (x, y, z) it has 3 components (xy, xz, yz), so it's similar to a axis vector.
      And in 4D (x, y, z, w) it has 6 components (xy, xz, xw, yz, yw, zw). You might need it for space-time (relativity).

    • @porky1118
      @porky1118 3 ปีที่แล้ว

      ​@@nottellinganyoneanything A simple example in physics, why you would prefer GA is torque (angular momentum).
      In 2D you would probably represent angular speed using a scalar, in 3D you would use an axis vector, where the magnitude represents the velocity.
      In GA, you would just use a bivector. A 2D (x, y) bivector has only one component (xy), so it's similar to a scalar.
      In 3D (x, y, z) it has 3 components (xy, xz, yz), so it's similar to a axis vector.
      And in 4D (x, y, z, w) it has 6 components (xy, xz, xw, yz, yw, zw). You might need it for space-time (relativity).

  • @anuman99ful
    @anuman99ful 2 ปีที่แล้ว

    Wait, in 16:30, isn't the (xy)(yz) product inconsistent with the cross product right-hand rule? Because the result yields xz which is what we would refer to -j (unit basis vector notation) in a cross product fashion, however, the product suggest that is k x i, which is j.

    • @angeldude101
      @angeldude101 2 ปีที่แล้ว

      I wouldn't be able to say because I have no idea which direction "j" rotates in, where as (xy)(yz) clearly is oriented in the direction from x to z. Setting i = x* = yz, j = y* = zx, k = z* = xy
      ij = yzzx = yx = -k, So clearly the simple way I defined them doesn't align with the quaternions exactly, even if I made them with a right handed dual operation. The best guess I can give is that the quaternions aren't actually right handed, and were instead picked to satisfy ijk = -1. If I redo my setup, but with j = yx, then suddenly the ijk = -1 identity works again, though flipping any of the unit bivectors should give the same result.

  • @charlesbrowne9590
    @charlesbrowne9590 3 ปีที่แล้ว

    At 13:15, Ra(v) belongs in the first quadrant. Vectors v|| and v_| are swapped in the picture.

    • @charetjc
      @charetjc 3 ปีที่แล้ว

      The reflection isn't over vector A, it's over the plane that A is normal to. Also, parallel and perpendicular notation implies a relationship of vector V with something else. If the author meant the reflection plane, then the notation is correct as is.

  • @DrakeLarson-js9px
    @DrakeLarson-js9px 7 หลายเดือนก่อน

    Your instinct was sound.. it is somewhat overly complicated ... it is rotation (and how to describe?) and Hamilton 1843 notice of the twirling vortexes of water under the bridge was the foundation of this.. which is useful for 'creative projections' ... (This video is a ton of information in under 20 minutes, Congratulations.)

  • @Plamenko8L
    @Plamenko8L 3 ปีที่แล้ว

    There is an error in the reflection calculation. Formulas for the parallel and perpendicular components were exchanged. The correct formula for Ra(v) is "2(v.a)a - v". I.e. the whole thing is negated.

  • @TheMatyw
    @TheMatyw หลายเดือนก่อน

    This is such a great video, thanks for sharing

  • @pladselsker8340
    @pladselsker8340 3 ปีที่แล้ว +1

    This seems unpractical to me. My quaternion rotations are working just fine. It's a well made video though, I think the editing is pretty good.

  • @jcbahr
    @jcbahr 2 ปีที่แล้ว

    Kept expecting you to bring up the Hodge star
    (It's the duality map between (n-k)-vectors and k-vectors in Rn. So in 3D, it's the map between bivectors and vectors. And in 2D if you want, it includes the map between bivectors and scalars (0-vectors))

    • @marctenbosch
      @marctenbosch  2 ปีที่แล้ว +1

      It was outside of the scope of this video! If I made another video I would talk about it for sure!

  • @patrickdoyle4581
    @patrickdoyle4581 3 ปีที่แล้ว +1

    10:58 - The geometric product seems more like a tuple than a sum, at first glance. With complex numbers, a sum makes sense because of how arithmetic works out (starting with i*i = -1). I'm not seeing a similar feature with the geometric product; is there one?

    • @ahusky4498
      @ahusky4498 3 ปีที่แล้ว +2

      If you want to be technical, the addition of different graded elements is actually a direct sum (a way to add vector spaces together). So you can establish vector spaces for scalar, vectors, bivectors and etc. Then from there you can define define geometric product and its properties

    • @porky1118
      @porky1118 3 ปีที่แล้ว +1

      any plane of basis vectors has the same properties as "i". Just replace i by the plane.
      For example if your basis vectors are x and y, then this is true:
      xy * xy = -1

    • @ahusky4498
      @ahusky4498 3 ปีที่แล้ว

      @@porky1118 that is also assuming the basis vectors both of positive signature (or both negative) and the product is normalized

    • @porky1118
      @porky1118 3 ปีที่แล้ว

      @@ahusky4498 I used x and y as used in the video.
      Normally, x and y are called e_1 and e_2

    • @danielm6846
      @danielm6846 3 ปีที่แล้ว +1

      Any one of these bivectors also squares to -1 if that helps. A bivector and a scalar together is algebraically the same as a complex plane.

  • @JordanWeitz
    @JordanWeitz 4 ปีที่แล้ว +6

    Has @3Blue1Brown seen this? So good.

    • @kevinportillo9882
      @kevinportillo9882 3 ปีที่แล้ว +3

      I was thinking about this too! It seems like this should be the norm since it's so generalized

  • @jtsiomb
    @jtsiomb 3 ปีที่แล้ว +2

    Nice demonstration, love the visualizations, and interesting alternative way of thinking about the same thing, but I'm not sold on this being somehow simpler than quaternions, just because you hid the 4th dimension behind a cross product and a dot product. I see them as equivalent, and the quaternions have the advantage of building on the familiar complex algebra.

    • @angeldude101
      @angeldude101 3 ปีที่แล้ว +1

      Well in GA, the complex numbers are just the 2D rotors like how quaternions are 3D rotors. The bivector xy is the only bivector in 2D and plays the part of the imaginary unit to the point that it's often just called i. Making a 2D rotor e^iθ = cos(θ) + isin(θ), which should look extremely familiar. 3D rotors just add two more basis bivectors turning it into e^Bθ = cos(θ) + Bsin(θ) for any unit bivector B. 2D rotors even commute with themselves, even if they don't commute with vectors. But then again, complex numbers are usually just seen on their own without standard vectors in sight, so that doesn't really change anything until you add the standard vectors.
      Oh, and xy^2 = -1 comes entirely from the anticommutativity of the geometric product between orthogonal vectors, rather than being predefined as squaring to -1.
      I will point out that 4D rotors are _not_ octonions. The biggest difference is that rotor multiplication is always associative, where as octonions are non-associative.

    • @blinded6502
      @blinded6502 2 ปีที่แล้ว

      This video is all wrong. Rotors are as simple as they can be. They represent a reflection along two axes.
      I could explain it in more detail, if you're interested in *actual* math.

  • @msergejev
    @msergejev 2 ปีที่แล้ว

    Comment on 7:30, components of a bi-vector: aren't bi-vectors something of a "directional" surface, that contain also a information about the direction of rotation rather then just area of the surface? Is this information then contained in the individual contributions in the unit bi-vectors?

    • @marctenbosch
      @marctenbosch  ปีที่แล้ว

      Sorry for the late reply: yes, for example, you can see (earlier in the video) how in 2D I change the color of the bivector from blue to green when the rotation goes from clockwise to anti-clockwise. It is a "signed" area. In 3D you would have to multiply all three bivector components by -1 to represent the opposite rotation, just like negating a vector, which is equivalent to -(a^b) = b^a

  • @codatheseus5060
    @codatheseus5060 8 หลายเดือนก่อน

    I actually understand the quaternion stuff and it's not as complicated as it seems, but yes geometric algebra is easier to learn and work with

  • @legkamran
    @legkamran 3 ปีที่แล้ว

    underrated video...

  • @scotth.hawley1560
    @scotth.hawley1560 2 ปีที่แล้ว

    Very much enjoyed the video and the accompanying interactive document. Thank you for sharing. One thing that isn’t clear to me is why the pair of reflections give a rotation of twice the angle between a & b. I can see that this appears to be the case in the interactive graphs, but where is this proven? The speech “it turns out that…” is presumably a stand-in for such a proof but I’d like to see how to actually do it.

    • @Igdrazil
      @Igdrazil 2 ปีที่แล้ว +1

      Well as a start just draw it down on paper and check it! Its a basic but crucial elementary geometric proprety normaly lurn at school. Then play with it on GeoGebra to confirm your intuitions and visualise it in live. You can animate it and discover by this way the existance of an important INVARIANT (in fact a GAUGE INVARIANCE which gives an extra degree of freedom). Indeed you can chose a and b (or equivalently the two intersecting axes of symmetry) as you want, freely, as long as the angle between them remains half of the angle of the desired rotation.
      You can even visualy check this out easely in a particular situation. Indeed just aline one of the two axis of symmetry with the MEDIATRIX of the starting point and rotated one (arrow edges of a and a'). And check that the other symmetry axis just match with a or a', which demonstrate at least visualy the doubling angle phenomenae, between the angle separating the two symmetry axis, and the angle separating the rotated axis from a to a'.
      In 3D you can extend all that axial symmetry results to the composition of two planar symmetry that gives a rotation "around" the line of intersection of those two planes, again with the doubling of the angle between the two planes. Etc
      In higher dimensions, as for instance in 4D where one may play in supplement, as in video games, with the time axis for instance, making hybrid space-time rotations etc. Exactly same formula holds in GA, whereas you wont find any generalisation of quaternions to help you in such 4D dimensions. In other words you are stuck with quaternions in a PARTICULAR tool and REPRESENTATION, which has massive limits, whereas GA holds unchange in all dimensions, in all types of geometry (euclidian, non euclidian, relativistic, riemanian, quantic, quantic relativistic,...). So GA is a Universal tool. Once you master it you never have to change ship, plane, car,...you just travel with one universal adaptative meta tool! Its like a lego box in which you just build whatever particular tool you need, in such easy way as a kid play lego. This is the Revolution that is taking place. Its more important than the invention of computational algebra by François Viete.
      The practical power of GA is that you almost write down things as you think it, in an extreme straight forward way, and even code it just as you write it down without "if then else" or any tortuous mental and technical labyrinthe. As soon as simple basics are mastered you Think, Write, Code!
      Finaly for algebraic proof of this doubling angle phenomenae, its very simple in GA. Everything comes from the SANDWICH key. At the basic core, the miror of a vector a with respect to a line N spaned by a unit vector n is just the sandwich formula : a'=nan.
      To prove that is very simple with few basic tools. First recal the central Clifford wise DEFINITION of the ALGEBRAIC PRODUCT of two vectors a and b :
      ab=a•b+a^b
      Here a•b is the usual SYMMETRIC scalar (inner) product, capturing the scalar PROJECTION of a on b (equal to the one of b on a), and which is related to the magnitude |a| and |b| of a and b, and the COSINE of the angle between them, by the famous school formula :
      a•b=|a|.|b|.cos(a,b). This is a number. More, its an INVARIANT NUMBER (remaining the same in all change of reference frame to express a and b), called a SCALAR. In other words its an INTRINSIC "vector of dimension zéro", "point like" so to say.
      Then the other part of the right handside is a^b. It represent the ORIENTED PARALLELOGRAM spaned by a and b, going from a toward b. Meaning that b^a = - a^b represent the "same" parallelogram, but oriented in the opposit direction. This "multiplicative operator" noted "^" is thus called the ANTISYMMETRIC OUTER (or WEDGE) PRODUCT. And the outcoming entity a^b is called a BIVECTOR (intuitively an AREA, and more precisely an ORIENTED AREA).
      This WEDGE PRODUCT "^" il closely related to the usual CROSS PRODUCT "×", but only in 3D, where the former only exist, whereas the wedge product exist unchanged in ALL dimensions. Indeed their outcome a^b and a×b, are SIMILAR in both aspects, numericaly and geometricaly. First numericaly because their common (algebraic) magnitude is the SIGNED AREA OF THE ORIENTED PARALLELOGRAM spaned by a and b, spaning from a toward b. The absolute value of this signed area being given by the famous school formulae :
      |a×b| = |a|.|b|.|sin(a,b)| (which is Indeed the parallelogram positive AREA).Then geometricaly because, in 3D (alone) there is a fortuous isomorphism (one to one correspondance), between a plane and the NORMAL VECTOR to this plane! Thus, in 3D alone, one can fortuously associate, in a one to one correspondance, the VECTOR a×b (which is by definition, orthogonal to both a and b, thus to the plane spaned by a and b), and the BIVECTOR a^b (ORIENTED PARALLELOGRAM). One can screw in the a×b direction by turning in the orientation of a^b. Thus in 3D alone, the VECTOR a×b and the BIVECTOR a^b, though being different types of geometric objects, contain the same INFORMATION, and it is easy to build one from the other.
      They are in one to one correspondance, precisely given by the simple algebraic formula :
      a^b = i a×b,
      where i is the 3D unit unique PSEUDO SCALAR : i=xyz, where x, y and z represent 3 orthogonal unit vectors. Since x, y and z are mutualy orthogonal, the PSEUDO SCALAR i is in fact also equal to its ANTISYMMETRIC part, namely the TRIVECTOR x^y^z which represent the ORIENTED UNIT CUBE spaned by x, y and z :
      i = xyz = x^y^z
      But recall, that this fortuitous correspondance between "×" and "^", ONLY WORKS IN 3D. In 2D or 4D and more, a×b no longer exist, while a^b remain unchanged. Suprême advantage again of GA!
      Finaly, we will need a straight forward formula springing out of this crucial definition of the ALGEBRAIC PRODUCT :
      ab = a•b + a^b
      Thus : ba = b•a + b^a
      But b•a = a•b, by SYMMETRY of the inner (projective) product. And b^a= - a^b by ANTISYMMETRY of the wedge product. Thus :
      ba = a•b - a^b.
      Hence by summing this last identity with the first one ab = a•b + a^b, gives :
      ab+ba = 2a•b
      This usefull important result gives the way to compute a•b when knowing both ab and ba. We will use it in the following proof.
      So with these basic tools in hand the proof of the AXIAL SYMMETRY FORMULAE : a' = nan, becomes easy. The shortest way is to simply write down in algebraic form, the very definition of the axial symmetry of the vector a, with respect to the axis spaned by the unit vector n :
      a'+a = 2(a•n)n
      since a'+a represent the full DIAGONAL of the parallelogram spanned by a and a', whereas (a•n)n only represent the vectorial projection of a (or a') on this DIAGONAL spaned by n, thus only the HALF, which proves the need for the 2 factor.
      So starting with this straight forward basic premice : a'+a = 2(a•n)n, we then get :
      a' = 2(a•n)n - a
      But by using the proved formula :
      ab+ba = 2(a•b), and rewriting it for generic b being our wanted n, we get :
      an + na = 2(a•n). This gives the key to our proof :
      a' = (an + na)n - a = ann + nan - a = nan, since nn = n•n + n^n = n•n = 1. QED
      Now with this fundamental result in hand, it is easy to compose two such miror imaging with respect to two unit vectors n than m, spaning two MEETING axis of symmetry. It gives : a'=nan and a"=ma'm, which gives by combining :
      a"=m(nan)m=mnanm=(mn)a(nm).
      There emerges the obvious but crucial entity "mn" springing out of this direct and easy computation. We call it a ROTOR, since it will act in a rotative generalised way. Indeed we can write, thanks to the previous recalled formulae and the representation of exponential and trigonometric functions by power series, the explicit (coordonate free) expression of the algebraic product of the two unit vectors m and n, as follow :
      mn = m•n + m^n
      = m•n + i(m×n)
      = |m|.|n|.[cos(m,n) + sin(m,n).ik]
      = cos(m,n) + sin(m,n).ik
      =cos(t) + sin(t).ik
      = exp(ikt)
      Where t represents the angle (m,n), k the unit vector aligned with m×n (which lengh is sin(t)), and ik the algebraic product between the TRIVECTOR i and the VECTOR k, which gives a BIVECTOR ik.
      Recall that k is a VECTOR, i is the unique UNIT TRIVECTOR (PSEUDO SCALAR) : i= xyz, and the algebraic product of the VECTOR k with the TRIVECTOR i, gives the BIVECTOR m^n (normalised to unit length). So i is bridging VECTORS and BIVECTORS!
      Thus by this last compact exponential expression one gets the best intuitive algebraic form of what is going on. The situation is no more than the straight forward generalisation of the 2D situation captured by the exponential form of complex numbers representing a pure rotation in the "complex plane" of angle t : exp(jt)
      Here in 3D, the unique add is the presence of the k unit vector (colinear to m×n), that is "hidden" so to say in the basic complex plane, since it would spring OUT OF IT, orthogonaly! More than meaningless, its useless since there is no choice to rotate in the complex plane other than the obvious and unique one !
      But no suprise that k is needed in 3D to fixe the "axis of rotation" which is perpendicular to the plane [m,n]. So it now gets clear why we call ROTOR the crucial entity :
      mn = exp(ikt)
      Since it rotates (just as exp(it) does in the 2D usual complex plane) "around" the k axis, by an angle t! And just as in the usual complex plane situation it is then obvious that the SANDWICH formula :
      a" = (nm)a(mn)
      brings a doubling of the angle, since the ROTATION (ROTOR) mn=exp(ikt) is applied TWICE. It is Indeed, even though it seems that nm= exp(-ikt) acts on the LEFT of the vector a, with the angle (-t). In fact, thanks to the non commutativity of the geometric product, it actualy adds its effect to mn=exp(ikt) acting on the RIGHT of the sandwiched vector a, in such way that the resulting rotation is of angle 2t which is thus the double of the angle between m and n.

    • @scotth.hawley1560
      @scotth.hawley1560 2 ปีที่แล้ว

      @@Igdrazil Thank you!

    • @Igdrazil
      @Igdrazil 2 ปีที่แล้ว

      With pleasure, enjoy magic Maths.
      You may wish to finish the calculation of the last part of the proof that I left in "semi intuitive evidence". It's quite interesting and instructive to actualy make the full calculation to see the double angle algebraicaly springing out. In addition we will compare the GA skills and speed with the "old classic algebra" ones (which will show so much more laborious).
      At first, one instructive aspect of the calculation will be to lurn not to make the following vicious mistakes and wrong reasoning, by naively "finishing" the proof in 2D with usual complex numbers. For that lets apply the proved final formula : a" = exp(-it).a.exp(it). Thus by writing also a as a complex number a=r.exp(iw) we get :
      a" = exp(-it).r.exp(iw).exp(it), which gives by the property of exponentials : a" = r.exp(-it+iw+it)=r.exp(iw) = a ...
      which is obviously shear non sens!
      So what went wrong here? Well precisely that i=xyz, is NOT the usual imaginary j of complex numbers world (that squares to minus one). And thus we are NOT a priori in commutative world anymore, and that changes everything. We have to be more carefull.
      So lets now FORGET the last completely FALSE calculation and understand what gone wrong by finding how to write things correctly. Since we place ourself now in the restricted situation of 2D, the pseudo scalar i is no longer xyz, but more simply xy since there is only two basic orthonormal vectors x and y. So : i = xy = x^y, is a BIVECTOR and at the same time the PSEUDO SCALAR of this 2D world.
      So to end the proof we need to compute carefully the products lying in the crucial formulae :
      a" = exp(-ti).a.exp(ti)
      Lets first start with the GA method to see how fast and simple it is! Indeed being in 2D brings a strong shortcut. If we were in 3D or more, we should carefully keep in mind that NEIGHTHER i, NOR exp(ti), NOR exp(-ti), does commute in general with the vector a! This comes from the fact that this BIVECTOR i = xy IS NOT the imaginary j of complex number world whoes square is minus one, even if the BIVECTOR i = xy also squares to minus one! There are in fact many objects in mathematics that square to minus one. Carrefull not to confuse them!
      But in 2D a strong simplification emerges. Indeed the vector a is by construction coplanar to the bivector i = xy = x^y, since there is only one plane! And in such case we have : ai = a.(x^y) + a^i = a^i = - i^a = - ia . Result that can also be cheched by detailed "coordonate" calculation :
      Indeed : ai = (px+qy)xy = pxxy+qyxy = py-qx
      and : ia = xy(px+qy) = pxyx + qxyy = - (py - qx).
      And by extension we have for the same reasons :
      exp(-ti)a = aexp(ti), thus we get immediately :
      a'' = exp(-ti)aexp(ti) = a exp(2ti), showing explicitely the double 2t angle of the final rotation.
      Lets now compare this fulgurant GA method with the old classic algebra where we dont have such tools to shortcut. We thus decompose more laboriously the vector a on the orthonormal basis (x,y) : a = px+qy
      And use the algebraic expresion for
      exp(ti) = c+si = c+sxy
      noting c = cos(t) and s = sin(t)
      Thus similarly :
      exp(-ti) = c - si = c - sxy
      The calculation is straight forward but more lengthy and leads to the first partial result :
      a" = exp(-ti)a exp(ti) = (c - sxy)(px+qy)(c+sxy)
      = [p(c^2-s^2) - 2qcs].x + [2pcs+q(c^2-s^2)].y
      Its at this point that the DOUBLE ANGLE shows up through the trig formulae :
      cos(t)^2-sin(t)^2 = cos (2t)
      2cos(t)sin(t) = sin(2t).
      Trig formulae that can be proved using usual complex numbers (with j^2 = -1), thanks to the corner stone exponential shortcut formulae :
      exp[j(t+s)] = exp(jt).exp(js)
      Which expands in trig form as :
      cos(t+s)+j.sin(t+s) = [cos(t)+j.sin(t)].[cos(s)+j.sin(s)]
      That gives immediately, by developing the product :
      cos(t+s) = c^2 - s^2
      sin(t+s) = 2cs
      where c = cos(t) and s = sin(t).
      Then taking the particular case where s=t gives the wanted formulae :
      cos(2t) = c^2 - s^2
      sin(2t) = 2cs . QED
      And so, back to our rotation formulae by the old classic algebra way, we get :
      a" = [p.cos(2t) - q.sin(2t)].x + [p.sin(2t) + q.cos(2t)].y
      wich can be writen
      a" = [p.C - q.S].x + [p.S + q.C].y
      noting C = cos(2t) and S = sin(2t)
      The result may seem obvious to trained eye, but if not we can put it in matrix form for more compactness and transparency :
      a" = W.a
      where a is the column vector [p / q], and W the 2 by 2 matrix [C ; -S / S ; C], which is obviously ORTHOGONAL since its DETERMINANT D = C.C - S.(-S) = C^2+S^2 = 1 , signature of a DIRECT ISOMETRY, which is necesseraly in 2D, a ROTATION of angle 2t ! QED
      We now understand beter why our naive first 2D calculation with exp(-jt)aexp(jt), with the usual imaginary j, led nowhere else than shear non sens, whereas the correct careful calculation of exp(-it)aexp(it) with the BIVECTOR i = xy, led in the NON COMMUTATIVE world of GA, to the correct calculation.
      As a lesson, NON COMMUTATIVITY is more tricky and must be handled with more care, but GA handles it very well and it opens to much deeper and richer world. In fact all our surrounding world is mainly NON COMMUTATIVE, starting with the spelling of words, or cooking, driving, dressing! Mix the right order and there comes the catastrophy!...
      Our wourld is in fact 99% NON COMMUTATIVE! We can try to express it with commutative tools, but we cant actually go far, clear and deep by this naive and incomplete aproach. Worse, since our world is actualy complicated, it can well appear even more complicated than it is if we try to discribe it with only commutative models. It may be used as a first try, to grabs easely some simple basics stuff, and we can be lucky by grabing quite a lot actually, like with j springing averywhere in relativistic quantic particle physics. But we soon end in a MESS, where all the carts have been messed up. And that leads to a point where the entire communauty gets totaly STUCK, frozen and blind!
      Thus GA is a RESCUE remedy in a state of cognitive MESS. It catches back the proper way to write things and discribe tools in the wise way. Thus everything start to lose his old mask and show his true face, his actual intrinsic geometric property and meaning. This is what is actualy hapening...in the real world of NON COMMUTATIVITY!

  • @tomoki-v6o
    @tomoki-v6o 7 หลายเดือนก่อน

    In solid mechanic there is what we call the Mohr circle where the transformations double the angle !

  • @BleachWizz
    @BleachWizz 4 ปีที่แล้ว +4

    nice, so if you ignore quaternions and come up with rules to allow you to rotate things in 3D you invent quaternions.
    shouldn't the outside part be reflected twice thus returning back to the original value? at 14:50

    • @marctenbosch
      @marctenbosch  3 ปีที่แล้ว

      No it's two reflections with different planes of reflection.

  • @erickweil4580
    @erickweil4580 4 ปีที่แล้ว +3

    I was working with 4D geometry and rotations, And then to rotate around a arbitrary 2d plane, is by defining the plane as a basis with x and y lying in the plane, but z and w outside ( all orthogonal to each other ), then the point is projected to this basis, rotated xy in 2d, and projected back. ( change basis with dot product, go back multiplying components by the vectors )
    Is correct to say that you do a similar thing, I mean, change the basis, apply a operation, then reverse the basis change?
    Is this why the operation is: ba v ab
    Quaternions also do the same thing.
    Idk but I see a pattern

    • @marctenbosch
      @marctenbosch  4 ปีที่แล้ว +5

      Yeah, all "sandwich" product like that are changes of basis.

  • @StefanReich
    @StefanReich 3 ปีที่แล้ว +1

    I got so much smarter by watching this video!

  • @2fifty533
    @2fifty533 ปีที่แล้ว

    so, what are quaternions _actually_ useful for then? or are they essentially redundant since this exists

    • @angeldude101
      @angeldude101 ปีที่แล้ว

      Quaternions are useful for making rotors seem more complex than they really are, so that when you demonstrate your understanding of quaternions, you appear smarter than if you had communicated in terms of rotors. They're also useful for praising William Rowan Hamilton and his act of vandalism.
      In terms of actually doing math, there's nothing that quaternions can do that rotors can't, because 3D rotors effectively _are_ quaternions just with a more clear derivation and more explicit basis.

    • @2fifty533
      @2fifty533 ปีที่แล้ว +1

      @@angeldude101 late reply but i think it's a bit harsh to call hamilton a "vandal"
      without him, clifford algebras wouldn't even exist, Cl(3, 0, 0) was created from quaternions

    • @angeldude101
      @angeldude101 ปีที่แล้ว

      @@2fifty533 I mean, he literally was one. The site of his vandalism has literally become a historical site.

  • @jonathancapps1103
    @jonathancapps1103 3 ปีที่แล้ว +2

    @1:40 The way I understand it n-dimensional rotation pretty much always has smoother rotation interpolation in n+1 dimensions
    I remember understanding the explanation of why when I read it, but that was almost 20 years ago.

  • @Miki19910723
    @Miki19910723 3 ปีที่แล้ว

    Yey i been doing dumbed down version of this whenever i needed complex interoplation beetween rotations or cordinate systems becouse deeling with order of rotations always made it wierd. I changed rotations to vectors and interpolated and rotated stuff there and converted back to object roatation at the end XD

    • @blinded6502
      @blinded6502 2 ปีที่แล้ว +1

      To interpolate between two rotors ideally you should take their logarithms, lerp them, and exponentiate your result.
      This is the perfect method to interpolate a transformation. The holy grail.