On the subject of Quaternions

Off topic discussion zone.

Moderators: winston, another_commander, Cody

User avatar
Zieman
---- E L I T E ----
---- E L I T E ----
Posts: 680
Joined: Tue Sep 01, 2009 11:55 pm
Location: in maZe

On the subject of Quaternions

Post by Zieman »

I may not be the only one to wonder what are those mysterious Quaternions, and why they are in Oolite. I bet Ahruman could give a nice, compact and easy to understand answer - before that one could read a bit:
However, quaternions have had a revival since the late 20th Century, primarily due to their utility in describing spatial rotations. The representations of rotations by quaternions are more compact and quicker to compute than the representations by matrices. In addition, unlike Euler angles they are not susceptible to gimbal lock. For this reason, quaternions are used in computer graphics,[10] computer vision, robotics, control theory, signal processing, attitude control, physics, bioinformatics, molecular dynamics, computer simulations, and orbital mechanics. For example, it is common for the attitude-control systems of spacecraft to be commanded in terms of quaternions
is a quote from the article http://en.wikipedia.org/wiki/Quaternion
...and keep it under lightspeed!

Friendliest Meteor Police that side of Riedquat

[EliteWiki] Far Arm ships
[EliteWiki] Z-ships
[EliteWiki] Baakili Far Trader
[EliteWiki] Tin of SPAM
User avatar
Selezen
---- E L I T E ----
---- E L I T E ----
Posts: 2530
Joined: Tue Mar 29, 2005 9:14 am
Location: Tionisla
Contact:

Re: On the subject of Quaternions

Post by Selezen »

I tried reading that article back when I started trying to make OXPs. I tried again after reading this post.
Wikipedia wrote:
In mathematics, the quaternions are a number system that extends the complex numbers. They were first described by Irish mathematician Sir William Rowan Hamilton in 1843[1][2] and applied to mechanics in three-dimensional space. A feature of quaternions is that the product of two quaternions is noncommutative. Hamilton defined a quaternion as the quotient of two directed lines in a three-dimensional space[3] or equivalently as the quotient of two vectors.[4] Quaternions can also be represented as the sum of a scalar and a vector.
I went crosseyed at the word "commutative". Again. Ironically, I use mathematics in my job, and I'm pretty sure quaternions would be useful. If I could only understand them...
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: On the subject of Quaternions

Post by Commander McLane »

Zieman wrote:
I may not be the only one to wonder what are those mysterious Quaternions, and why they are in Oolite.
Answer in two sentences: quaternions are a mathematical way to precisely describe a rotation in three-dimensional space. And they are in Oolite because Oolite needs to rotate things in three-dimensional space.

Voilà. :D
User avatar
Gimbal Locke
---- E L I T E ----
---- E L I T E ----
Posts: 293
Joined: Sun Jan 08, 2012 11:32 pm
Location: Brussels
Contact:

Re: On the subject of Quaternions

Post by Gimbal Locke »

Zieman wrote:
In addition, unlike Euler angles they are not susceptible to gimbal lock.
is a quote from the article http://en.wikipedia.org/wiki/Quaternion
While quaternions may not be susceptible to me, I find this resource most helpful: http://rosettacode.org/wiki/Quaternion_type , it shows how to define and compute with quaternions in 33 programming languages.

This video shows the problem: http://www.youtube.com/watch?v=rrUCBOlJdt4

This video shows the solution: http://www.youtube.com/watch?v=2XehAXAt0DE
Last edited by Gimbal Locke on Tue Mar 20, 2012 1:52 pm, edited 1 time in total.
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Re: On the subject of Quaternions

Post by Mauiby de Fug »

Non-commutative simply means that the order of operations makes a difference. For example, 2 * 3 = 3 * 2 is commutative. It doesn't matter which comes first. With quaternions, i * j = k, but j * i = -k. You get a different result.

Funnily enough, I can understand/follow almost all of that page. I think the useful bit is
Wikipedia wrote:
Conjugation by a unit quaternion (a quaternion of absolute value 1) with real part cos(θ) is a rotation by an angle 2θ, the axis of the rotation being the direction of the imaginary part.
User avatar
Fatleaf
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 1988
Joined: Tue Jun 08, 2010 5:11 am
Location: In analysis mode on Phaelon
Contact:

Re: On the subject of Quaternions

Post by Fatleaf »

And for a handy tool for working them out I have acquired a !Nothing to see here! along the way. Help yourself :D

EDIT: This isn't the post you are looking for :roll:
Last edited by Fatleaf on Mon Mar 26, 2012 11:59 am, edited 1 time in total.
Find out about the early influences of Fatleaf here. Also his OXP's!
Holds the Ooniversal record for "Thread Necromancy"
User avatar
Gimbal Locke
---- E L I T E ----
---- E L I T E ----
Posts: 293
Joined: Sun Jan 08, 2012 11:32 pm
Location: Brussels
Contact:

Re: On the subject of Quaternions

Post by Gimbal Locke »

Fatleaf wrote:
And for a handy tool for working them out I have acquired a Quaternion Generator along the way. Help yourself :D
Fatleaf, that links to a Windows executable. Do you have the source code for that or is it Windows-specific?
User avatar
Fatleaf
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 1988
Joined: Tue Jun 08, 2010 5:11 am
Location: In analysis mode on Phaelon
Contact:

Re: On the subject of Quaternions

Post by Fatleaf »

Gimbal Locke wrote:
Fatleaf wrote:
And for a handy tool for working them out I have acquired a Quaternion Generator along the way. Help yourself :D
Fatleaf, that links to a Windows executable. Do you have the source code for that or is it Windows-specific?
That is a good question :roll:

It works on Win7. But I don't have the source code for it. Give it a go and see if it works for you!
Find out about the early influences of Fatleaf here. Also his OXP's!
Holds the Ooniversal record for "Thread Necromancy"
User avatar
Okti
---- E L I T E ----
---- E L I T E ----
Posts: 700
Joined: Sun Sep 26, 2010 1:51 pm
Location: A GH shop, near witchpoint to Oresrati in Galaxy 8

Re: On the subject of Quaternions

Post by Okti »

My OXP's
And Latest Mission Coyote's Run
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: On the subject of Quaternions

Post by Thargoid »

Selezen wrote:
I went crosseyed at the word "commutative". Again. Ironically, I use mathematics in my job, and I'm pretty sure quaternions would be useful. If I could only understand them...
Commutative : A*B = B*A
Anti-Commutative : A*B = -B*A
Non-Commutative : A*B != B*A
User avatar
PhantorGorth
---- E L I T E ----
---- E L I T E ----
Posts: 647
Joined: Wed May 20, 2009 6:48 pm
Location: Somewhere off the top left of Galaxy 1 map

Re: On the subject of Quaternions

Post by PhantorGorth »

This image shows why rotations are non-commutative:

Image

90 degree rotations by the z then x axes gives a different outcome for 90 degree rotations by the x then z axes.
Chat and relax with other commanders in the [url=irc://irc.oftc.net/oolite]DS's Seedy Space Bar[/url]. The Coolest Bar in the Eight.

Phantor's OXPs: [EliteWiki] GalCop Rewards and [EliteWiki] Safe Docking
User avatar
Gimi
---- E L I T E ----
---- E L I T E ----
Posts: 2073
Joined: Tue Aug 29, 2006 5:02 pm
Location: Norway

Re: On the subject of Quaternions

Post by Gimi »

:idea: just lit in my head :mrgreen: . Thank you. (Not that I need it for anything important, but still interesting).
"A brilliant game of blasting and trading... Truly a mega-game... The game of a lifetime."
(Gold Medal Award, Zzap!64 May 1985).
User avatar
SandJ
---- E L I T E ----
---- E L I T E ----
Posts: 1048
Joined: Fri Nov 26, 2010 9:08 pm
Location: Help! I'm stranded down here on Earth!

Re: On the subject of Quaternions

Post by SandJ »

Oh, I see! Because when you swivel the object around the vertical z axis, the sides move around but the two side-on axes x and y don't move with them.

So if you:
- turn the die over on the x or y axis, then spin it around on the z axis
that won't be the same as:
- spin it around on the z axis, then turn the die over on the x or y axis
because different sides of the die are now facing the x and y axes once the die has been spun.


I now recall an Open University TV programme from the 1980s about the huge machines the Royal Mail use to turn letters the same way up. It does 3 possible transformations:
a) the letters drop edge-on into a hopper which, when full, tips through 90 degrees and the letters carry on - used to move the stamps to the next edge along the envelope, i.e. between the y and z edges. (x axis rotation)
b) the letters pass between two belts which go through a 180 degree twist - used to get the stamps all one the same side. (y axis flip)
c) the letters stack up edge-on on a bunch and a human picks them up, turns round 180 degrees and puts them back in the machine further down the line, to get the stamps from back to front but leaving them at the top. (z axis flip)

Because the envelopes start off 'flat' in a pile, one axis need only ever need a 90 degree turn and so there are 8 possible arrangements of how the letters come into the sorting office (otherwise it would be 16). (Stamp top right, stamp top left, stamp bottom left, stamp bottom right ... x 2 for the stamp being at the back = 8 arrangements.)

They did all the horrid 3D maths and then said "But if you watch this machine, it will make sense". I remember the machine and its transformations very well; it was a huge monstrous piece of mechanised mathematical genius, but the maths fell out of my head long ago.

I did not know I had forgotten so much.
Flying a Cobra Mk I Cobbie 3 with nothing but Explorers Club.OXP and a beam laser 4 proper lasers for company :D
Dropbox referral link 2GB of free space online + 500 Mb for the referral: good for securing work-in-progress.
User avatar
Staer9
---- E L I T E ----
---- E L I T E ----
Posts: 570
Joined: Fri Feb 18, 2011 4:53 pm
Location: Hatfield, Hertfordshire (poor industrial)

Re: On the subject of Quaternions

Post by Staer9 »

Fatleaf wrote:
And for a handy tool for working them out I have acquired a Quaternion Generator along the way. Help yourself :D
I aquired (from a different source) the very same thing but was told that it is completely illegal to redistribute it in any way shape or indeed form, so you might want to remove it before said source returns to the BB and gets mad :wink:

unless of course you aquired permission, in which case I appologise :P
Image
User avatar
Fatleaf
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 1988
Joined: Tue Jun 08, 2010 5:11 am
Location: In analysis mode on Phaelon
Contact:

Re: On the subject of Quaternions

Post by Fatleaf »

Staer9 wrote:
Fatleaf wrote:
And for a handy tool for working them out I have acquired a Quaternion Generator along the way. Help yourself :D
I aquired (from a different source) the very same thing but was told that it is completely illegal to redistribute it in any way shape or indeed form, so you might want to remove it before said source returns to the BB and gets mad :wink:

unless of course you aquired permission, in which case I appologise :P
Thanks for that. The sorce I got it from failed to state that it shouldn't be shared! :roll:

Hey ho, it's gone now!
Find out about the early influences of Fatleaf here. Also his OXP's!
Holds the Ooniversal record for "Thread Necromancy"
Post Reply