Jump to content
• Advertisement

# 4d wrapping

This topic is 2850 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Hey trying to wrap my head around quaternions, because I like to understand a concept and code it myself rather than just copy paste someone elses highly efficient shared code.

I'm looked at the multiplication table and didn't understand why i * i = -i. I found the answer under imaginary number multiplication. Once I understood that I understood why but relating that to
i * i = j * j = k * k = ijk = -1

still didn't quite add up in my head. The only way I figured this could work would be if
i = 1;j = 1;k = 1;

Started looking up why, and finally found an answer in my Mom's old Calculus book that I think explains this.
Unit Vector - A vector whose length is equal to 1.
or
Given A is a vector and A.x, A.y, A.z are cartesian coordinates of this vector;
........-------------------------------
1 = \/(A.x*A.x)+(A.y * A.y)+(A.z * A.z)

A unit vector can be defined as components (A.x, 0, 0), (0, A.y, 0), (0, 0, A.z)
as such any vector can be defined as a Special Unit Vector. Or
A = (A.xi, A.yj, A.zk). Suddenly I hit a eureka as I saw a repeat of these values i, j, and k.
So I trodded around all morning looking for a confirmation that i, j, and k are assumed to be imaginary unit vectors for the given Quaternion. I didn't find that validation so I decided I'd ask here.

Sorry if the post is a little lengthy, but I wanted show what understanding my current research has lead me to. So that I could be corrected if I was misunderstanding something.

#### Share this post

##### Share on other sites
Advertisement
Yes, the i', j' and k' are historically the same thing as the usual base of R^3, but I don't know how much that's going to help you understand quaternions.

The first thing you should do is make sure you understand complex numbers and how complex multiplication relates to 2D rotation.

Then I would recommend you try to read some material online to gain an intuition about how quaternions work and how they represent 3D rotations: A Google search seems to return reasonably good texts.

#### Share this post

##### Share on other sites
"Yes, the i', j' and k' are historically the same thing as the usual base of R^3, but I don't know how much that's going to help you understand quaternions."

Thank you for the confirmation here is what was in my head as a result of these being unit vectors if this was indeed true.

Well it can be assumed that a unit vector is also a radius of a Unit Circle. I assumed that taking three unit vectors could derive a unit sphere(but I couldn't do this until I could validate they each were unit vectors). From there it is safe to assume that you can find any given angle in radians and degrees from any given two points within that sphere using the calculus omega function. Angle between any two vectors or points can be derived from.
Both A and B are vectors
(I believe this equation is coplanar though so that you can translate it to a change in X, Y, or Z
)
cos Omega = (A*B)/A.length * B.length

or

Omega(radians) = acos((A*B)/(A.length * B.Length))

Then knowing that i, j, k represent a "unit" vector of a "unit" sphere then you could establish that unit as a One radian or Pi. (this opens a huge door of already known equations on the unit circle) Knowing that any point in space is created by 3 Planes XY, XZ, YZ you could assume the same would be true with any point on this sphere being represented by 3 diffent unit circles Unit Circle XY, XZ, YZ.

Then expanding XY, XZ, YZ to their corresponding "special unit circle" which would have a radius of the "Special unit vector" of the given vector and following the logic of a calculus sphere equation you could find a new position based on a old position and a given angle in either radians or degrees and vice versa, and as long as it satisfied the sphere equation then it would be safe to assume this is a correct point on a given sphere (and rotation is nothing other than movement along the surface of a given sphere/circle). Using the unit vector though this last step isn't needed because we already put it on a unit 1 we would just have to multiply by its real number to get the value of the new position that creates the given angle and lies on the sphere. Obviously the order of rotations around each given special unit circle would create a different product so it wouldn't be communitave.

What I'm not able to figure out at this moment, why the need for W. And based on Einsteins theory of relativity why even W and not T? And if it was T then it could be assumed that all objects in a current rendering process have the same T so why even use it at all?

Thank you for the confirmation on this being a unit vector. I can try to learn how to proof Hamilton's theory of multiplication of Quaternions.

#### Share this post

##### Share on other sites
Do some more reading. And keep Einstein out of this.

#### Share this post

##### Share on other sites
read:
http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation

Quaternions are an abstract mathematical system. It just turns out that they're useful to represent rotations. They were not developed to represent rotations nor do they really represent anything that actually exists. It's just math, try to keep reality out of it and you'll go less insane. [smile]

-me

#### Share this post

##### Share on other sites
"Do some more reading. And keep Einstein out of this."

I was hoping to get actual mathematic responses, not insults of implied ignorance that mean nothing when they are unquantified. A measurement by which you imply my inacuracy would be most appreciated i.e. a formula by which the thinking is incorrect. Which scientist do you propose we keep in this? Just Hamilton? Its mathematics naturally derived from "proven" laws of other scientists applied by a given uncertainty. If you want to keep Einstein out of your games that cool, but I'd rather have the possibility of a nuclear explosion.

"Quaternions are an abstract mathematical system. It just turns out that they're useful to represent rotations. They were not developed to represent rotations nor do they really represent anything that actually exists. It's just math, try to keep reality out of it and you'll go less insane."

Thanks for the link I don't know how I missed that wiki page. I've spent many hours since I heard about quaternions(yesterday) reading and learning the math. Had I found that link myself I wouldn't have needed to pose the question about unit vectors. The philosophy of the generation of a hypersphere in the beginning part is exactly what I was talking about above is three special unit circles can derive any given rotation point needing 3 different hyperspheres if you are rotating on 3 axis around one point. It has a lot better explanation of the math though. I very much appreciate that. Oh and why would I want reality out of my games? Even the best surrealistic games follow a system coherant to reality. How could you derive that 1 = 1 without a reality by which to stand in and say yep that rock is definitely itself.

#### Share this post

##### Share on other sites
Quote:
 Original post by lesshardtofind"Do some more reading. And keep Einstein out of this."I was hoping to get actual mathematic responses, not insults of implied ignorance that mean nothing when they are unquantified.

Sorry, I didn't mean to insult you. But you wrote a whole lot of text based on not much understanding of the situation, so I suggest you read more, get familiar with the computations, write some code, experiment a bit... These things take time. If you just heard about quaternions, it's understandable that you are confused.

I am going to try to explain why some of the things you said didn't make sense to me. But please don't take it as an insult.

Quote:
 Well it can be assumed that a unit vector is also a radius of a Unit Circle.

I am already not sure of what you mean. The radius of a circle is either a segment or a length, not a vector. And if you mean to imply a circle centered at the origin, and to have the vector represent the segment from the origin to some point at a distance of one, you should really say these things. Even then, there are many possible circles for which that segment is a radius.

Quote:
 I assumed that taking three unit vectors could derive a unit sphere[...]

That part I just don't understand at all.

Quote:
 From there it is safe to assume that you can find any given angle in radians and degrees from any given two points within that sphere using the calculus omega function. Angle between any two vectors or points can be derived from.Both A and B are vectors(I believe this equation is coplanar though so that you can translate it to a change in X, Y, or Z)cos Omega = (A*B)/A.length * B.lengthorOmega(radians) = acos((A*B)/(A.length * B.Length))

This is how angles are defined. I don't know what it has to do with your three circles, though.

Quote:
 Then knowing that i, j, k represent a "unit" vector of a "unit" sphere then you could establish that unit as a One radian or Pi.

Now you are mixing vectors and angles. I don't understand what you mean. Are you talking about rotations already?

Quote:
 Knowing that any point in space is created by 3 Planes XY, XZ, YZ you could assume the same would be true with any point on this sphere being represented by 3 diffent unit circles Unit Circle XY, XZ, YZ.

Points are not "created" by planes. There are other things you can say about points and planes that might be what you mean, but as it is, I don't understand it.

Quote:
 [...whole paragraph where I didn't understand anything...]What I'm not able to figure out at this moment, why the need for W. And based on Einsteins theory of relativity why even W and not T? And if it was T then it could be assumed that all objects in a current rendering process have the same T so why even use it at all?

It is not the case that any 4-dimensional space represents the space-time continuum of Einstein. This one in particular has nothing to do with it. You cannot interpret the real part of the quaternions as time because that's not what it represents.

I would go back to the way complex multiplication by a unit-length number represents 2D rotation. The real part is the cosine of the angle of rotation. In quaternions the situation is similar, except rotation is achieved by multiplying a quaternion times a vector times the inverse of the quaternion (the conjugation of the vector by the quaternion), so you end up applying the angle twice, so the real part is the cosine of half the angle. This last sentence is not very precise, but perhaps it can help you develop some intuition.

In complex numbers, the real part tells you how much you'll rotate by, and the imaginary part is then determined up to sign by the fact that the length should be 1. The sign just tells you which way you rotate. In 3 dimensions, the real part still tells you how much to rotate, but now you need to specify which axis to rotate around, which is why you need a three-dimensional imaginary part.

#### Share this post

##### Share on other sites
Quote:
 You wrote a whole lot of text based on not understanding the situation

I wrote a whole lot of text based ON calculus and trignometry. What you are correct is I didn't understand the quaternions as a whole and the neccesity. What I described above is how OpenGL already rotates.

The unit vector unit circle thing isn't hard to understand.

Unit Vector - a vector whose length is equivalent to 1.
Unit Circle - a circle whose radius has a length of 1.

Then if Unit = Unit then 1 = 1 aka vector length = radius length. You can demonstrate this easily. As far as programming this level of rotation of course I've already been doing it for some time. It was a response to you telling me to go look up 2d rotations because you assumed I didn't understand how they work.

The point represented by 3 perpindicular planes is exacly how graphing 3 dimensional graphing works. The point 0, 0, 0 in its exhistence creates 3 perpindicular planes by which all coordinates can be measured. The point 1, 1, 1. Doesn't relate in any way to 0, 0, 0 if there was no planes created by which to measure every other point. This is a calculus explanation that I have read in at least 3 books.

None of what I posted about rotations applied to quaternation rotation, because I'm not convinced I have to use it yet. Hence the questions about how to proof it. So the next quaternation question I would like to pose is. In reference to

× 1  i  j  k 1 1  i  j  k i i −1  k −j j j −k −1  i k k  j −i −1

Which side is considered the number you are multiplying and which is considered the number that is being multiplied by. I need to understand this because
i * j != j * i since one apparently creates a positive version of k which one creates a negative version of k.

#### Share this post

##### Share on other sites
Quote:
 Original post by lesshardtofind[...] It was a response to you telling me to go look up 2d rotations because you assumed I didn't understand how they work.

Oh, no. We are not communicating well. I was asking you to look at how one can express 2D rotations as multiplication by a unit complex number. There are other ways of thinking of 2D rotations, and I am sure you are familiar with them, but they won't help you understand how to use quaternions to express rotations.

Quote:
 The point represented by 3 perpindicular planes is exacly how graphing 3 dimensional graphing works. The point 0, 0, 0 in its exhistence creates 3 perpindicular planes by which all coordinates can be measured. The point 1, 1, 1. Doesn't relate in any way to 0, 0, 0 if there was no planes created by which to measure every other point. This is a calculus explanation that I have read in at least 3 books.

It's not that what you are saying is wrong, it's that the language you are using is not precise enough. I don't think there is a definition for this process of "creation" that you talk about. But it probably doesn't matter much.

Quote:
 × 1 i j k 1 1 i j k i i −1 k −j j j −k −1 i k k j −i −1 Which side is considered the number you are multiplying and which is considered the number that is being multiplied by. I need to understand this becausei * j != j * i since one apparently creates a positive version of k which one creates a negative version of k.

I don't think there is a convention for this. Sometimes people talk about "multiplying on the left" or "multiplying on the right". But it doesn't matter: You can just say a*b, and that's it.

If you are not sure how to interpret that table, remember that i * j = k, so it has to be the number on the left times the number on top.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
18
5. 5
• Advertisement

• 14
• 28
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631772
• Total Posts
3002260
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!