Hacker News new | comments | ask | show | jobs | submit login
Visualizing quaternions: An explorable video series (eater.net)
297 points by beneater 89 days ago | hide | past | web | favorite | 32 comments

oof, the one thing i am wont to want with 3b1b videos is an interactive suite accompaniment.. unreasonably ungrateful i know ;P

i had high hopes this would be it, but this is just a concise lesson form for the series.. which is great! i am a huge fan of both eater's and sanderson's entire ouvre

what's great is that 3b1b releases the code that generates these videos and i have cloned the manim(o) library a number of times in the past when a video had an idea i wanted to play around with but the effort usually gets a low priority and i get distracted with more pressing projects

i figure a simple localhost python server serving up dynamic frames generated by manim could do the trick, maybe i'll work at it again this weekend

when i want to learn a new mathematical concept i like to write the source myself, which is great for getting at the nuts and bolts but it is usually after i have done this and start to tweak the models or constants that i begin to gain a real intuitive understanding of an underlying concept

(o) https://github.com/3b1b/manim

HA! that is exactly what this is.. my bad

i had thought the shorter clips were just that, clips from the 3b1b videos, but when i decided to click through it's much more than that

they are calling it explorable video

the videos are fully interactive.. this is awesome!

is this framework based on OpenGL?

i'm unsure exactly how frames are drawn..

the repo has a number of custom self defined objects that allows for pretty abstracted handling

it appears the frames are drawn ad hoc using PIL, SVG and or cairo libraries with the spatial reasoning done explicitly in the source

no, its WebGL - see http://disq.us/p/1wv9zek

I know I’m getting annoying with this but dual quaternions are even whackier. They are the best formalism for reasoning about 3D space developing over time.

Here’s a cool demo http://www.chinedufn.com/dual-quaternion-shader-explained/

They seem to correspond to linear logic which is insanity.

You always write a similar comment but neither you or the page you link explain what is the advantage, or even the difference, of dual quaternions when compared to normal quaternions. However, the article linked in the site, actually gives a good explanation.

Dual quaternions work not only rotations, but also translations. They provide a natural representation of rotations around arbitrary axis (not only around axis from the origin) and can also be easily combined or interpolated.

These dual quaternions look interesting for many cases, but they do not provide any advantage with respect to normal quaternions when working with pure rotations. For more complex transformations, I know there are some approaches based on GA (and CGA) that I do not know in detail but I think (a gut feeling) that dual quaternions are just a special case.

I have posted it many times yes. You hit it on the head. They are very good for modeling for example rigid transformations or robot joints.

They are a special case of GA. I used to very much into GA only to realize that dynamic 3D is the most interesting space, the other spaces are actually kinda boring.

For sure they are an interesting concept, thanks for introducing me to them. I cannot apply them to my work (crystallography) because we are only interested in orientations, but they may come handy at some point.

I am never going to understand quaternions. I just accept this, now.

No one, not ever, has been able to explain them sufficiently for me, or in a way that I can grasp.

Oh well.

I was in the same boat until I stumbled across this yc podcast from a few weeks ago with Joan Lasenby:


She described an algebra called "Geometric Algebra" that has both standard vector spaces, complex numbers and quaternions as sub-algebras. Supposedly it simplifies a lot of the abstraction surrounding these concepts.

So I dug a little bit deeper and ended up watching these videos on YouTube that really helped me understand what she was talking about:


And WOW, the whole concept just made so much more sense. In 2D if you consider the area created from two vectors, it can have a "positive spin" or a "negative spin" based on the relative direction of the vectors (Like if you turn a handle clockwise vs. counter-clockwise). It turns out this property makes the square of this area negative (like the complex numbers). The same analysis can be done in 3D and the quaternions pop out. Pretty awesome stuff! I have been buying and reading books on the topic ever since, I feel like I need to re-educate myself on all the advanced math I learned in gradschool because this makes it all so much more compact and elegant.

Clifford algebra is exactly how I figured it out as well.

Here's the clearest explanation I can make:

Things have a "sided-ness" to them. In most mathematics, the definition of a plane ignores this sided-ness. Three points and you have a plane, right? But you can't describe the orientation of a plane with the points, because you can't tell which side is "up". A piece of paper has two sides, why doesn't a plane? This is important when describing rotation!

Anyone who has used a look_at function can understand this. You give it a point for the eye position, and a point for the eye to "look at". What is not described is how that eye is oriented. Is it upside down? Sideways? Right side up? Even vectors have a "side"! This is the "twist" that is often mentioned.

If you imagine yourself as the eye, you can imagine your eyes being in the same position, looking at the exact same point, but in many different perspectives. Lying on your side, doing a headstand, standing upright.

I'm not an expert and I'm probably wrong, but intuitively this is what I think that fourth dimension on the quaternion corresponds to.


“Young man, in mathematics you don't understand things. You just get used to them.” -- John Von Neumann

My approach to "understanding" (if that's the right word) the quaternions was to first memorise the various identities relating quaternion algebra to 3d rotations. I didn't actually "understand" them, and I still feel a bit dodgy with them, but I got used to them in a way. Second, it helps to try and solve some problems with them. That also gets you "used" to them.

The 3B1B videos are supplementary for me. I still find quaternions a bit miraculous. And Geometric Algebra doesn't seem like the solution for me, because it's another weird and even more complex formalism.

I tried on multiple occasions to understand Quaternions, but I never found the time to get them. It was like a personal mental block. I also bought into some of the pedagogical FUD surrounding quaternions and understood there were controversies surrounding James Clerk Maxwell's use of them.

In my search I by chance came across a book on "Geometric Algebra" -- or Clifford Algebra. It just so happens that Quaternions form a sub-algebra of the three-dimensional Clifford Algebra.

If you can get complex numbers, you can get Clifford Algebra in 2D. You can then go to Clifford Algebra in 3D.

I believe you can learn enough Clifford Algebra to "get" Quaternions in well under 20 hours, but also have a tool that generalises rotations to higher-dimensional vector spaces.

I'd previously had a topic I just couldn't understand in Fourier Transforms. I just never really got the point until one day it clicked. And when it did, it was no problem to me. That said, I never found any of the videos particularly useful before I understood. Likewise, I still don't find any of the quaternion videos too useful.

I found some course notes to be useful [0]. I then worked through "Linear and Geometric Algebra" by Alan MacDonald.

In short, don't give up. You can come to understand things by the most indirect of paths and your understanding will be all the better for it.

One hard-learnt tip if you do choose to go down this less-travelled route: Many expressions in GA can be simplified into wedge and dot products. I was needlessly writing down the algebraic expressions only to find they expanded back into these. So learn how to manipulate products early on and you'll save yourself from multi-page algebraic expressions.

[0] http://geometry.mrao.cam.ac.uk/2015/10/geometric-algebra-201...

"We always talk about learning disability, but never about teaching disability" - Eric Weinstein (paraphrased).

Don't worry. There's a lot of shit out there and it's not at all your problem if they don't feel satisfying.

I also used to think there was something wrong with me for not understanding or being satisfied with vauge intuitive descriptions of mathematical ideas. Then I discovered proof-based mathematics and realized that, heck, here finally is the unambigous, high-resolution, no-corners-cut explanaion I've always been looking for. (Sure, it's a lot of hard work to get to a satsifying end-point, but at least the problem has shifted from trying to parse vauge intuitive statements in a visual-heavy video, to being bottle-necked by my own will power and dicipline to go as deep into an understanding of a proof as feels necessary to reach a satisfying depth-to-effort equilibrium.)

Maybe proofs aren't the key for you (or maybe they are), but don't blame yourself if you don't find the resources out there satisfyingly understandable.

Dont give up math is just a lot of practice. You can do it!!!

They're basically the ratio of two vectors, if that helps.

Check out Geometric Algebra for more info, specifically the 5D Conformal model [0]. It's way easier to use than linear algebra and that acres of sin()/cos()/tan() scattered everywhere in your code.

[0] http://versor.mat.ucsb.edu/

This video might be easier to grasp:

Fantastic Quaternions - Numberphile https://youtu.be/3BR8tK-LuB0

It also helped me to have a use-case in mind —- a motivation. Like maybe using the accelerometer/compasss in your phone to perform image stabilization or AR.

I’ve felt this same way over the years. Worse is that I may have grasped them, if only in the most superficial way, only to have lost those gains to time.

I think one has to take some time to understand the foundations upon which quaternions are based versus jumping right in.

Am I the only one who is utterly incapable to learn anything from a video? I read many hours per day, and look at figures, and try to understand them. But I cannot stand to wait for a three-minute video to finish. Why do people prefer linear videos to text that you can read at a whole?

Hey man. Sorry to be a shameless plug here. But I am working to solve exactly this.

Text based learning using a chatbot. A platform which takes care of your learning, spaced reptitions, notebook generations and all.

If you can just take some time to subscribe, that would be great. https://tinyletter.com/primerlabs/

I will launch soon.

People who don't read much tend to have developed an ability to learn through videos.

Discussion about quaternions from 6 days ago: https://news.ycombinator.com/item?id=18265355 (99 comments)

Suppose you are standing anywhere on planet Earth, and you look at the horizon (not up, not down, so 360° of choice).

A normalized quaternion encodes your position on the planet + the direction you are looking at on the horizon.

It also encodes the rotation it would take to go from one such observer to another.

Does this assume the earth is a sphere? Can you keep the elegance of this coordinate encoding with convenient transformation operations and define somewhere a mapping from the quaternarion encoding of position into a non-homogenous oblate spheroid encoding like WGS84 ...?

> Does this assume the earth is a sphere?

Of course, speaking about Earth is just for the mental image.

> Can you keep the elegance of this coordinate encoding with convenient transformation operations and define somewhere a mapping from the quaternarion encoding of position into a non-homogenous oblate spheroid encoding like WGS84 ...?

I don't understand the question.

So it's your position in space (3 numbers), your orientation (another 3 number vector), except instead of 6 numbers it can be reduced to 4? Stargate was wrong?

Encoding your whole orientation would require 3 numbers. You are restricted only to the horizon, so one number is enough.

Orientation is only two numbers, since a unit vector does the job? So, three numbers in total?

That's why it doesn't encode free orientation.

I was just watching this in my other tab... https://imgur.com/a/aGj6tXy

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact