•      Sign In
• Create Account

# About vectors

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

11 replies to this topic

### #1belfegor  Crossbones+   -  Reputation: 2817

Like
0Likes
Like

Posted 16 May 2012 - 01:43 PM

This article is not clear enough so i have to ask.

1. A vector of length 1 is "unit" vector? Normalized vector right?
I can find an angle between these kind of vectors by :
angle = acos( A dot B)

Even if it is larger then 90 degrees?

2.
Some definition of acos i don't understand:

Return value:
Principal arc cosine of x, in the interval [0,pi] radians.

What is "interval" word mean? Range?

Thanks for your time.

Sponsor:

### #2belfegor  Crossbones+   -  Reputation: 2817

Like
0Likes
Like

Posted 16 May 2012 - 02:10 PM

My mistake..

Edited by belfegor, 16 May 2012 - 02:12 PM.

### #3frob  Moderators   -  Reputation: 33342

Like
0Likes
Like

Posted 16 May 2012 - 02:22 PM

These fall into the "if you have to ask, you probably aren't ready" category.

You are asking about some fairly fundamental math definitions.

1a) Correct. A unit vector has unit magnitude, yes. That is length of 1.
1b) Normalizing a vector means to give it unit magnitude. Note that a normalized vector is very different than a normal vector.
1c) Correct.

2a) Mathematically an interval is a section of the number line. The one described is a closed interval including zero and pi.
2b) A range is the map of a domain, or in other words, the output possibilities of a function given certain input. The range is not necessarily an interval. A range can have zero or more intervals; some functions have zero intervals, others have infinitely many intervals for output.

It is very difficult to succeed in 3D programming without completing mathematics classes up through linear algebra. 3D graphics is simply an application of linear algebra. Many people attempt to struggle through and teach themselves a few minimal maths to hobble through, but few of them actually succeed without careful study of the math.

If you are struggling with basic trigonometry like cosines you probably ought to either wait until you have had more math classes in school, or get some time with a math tutor who can tutor you through trig, algebra, basic calculus, and linear algebra.

Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I occasionally write about assorted stuff.

### #4KymikoLoco  Members   -  Reputation: 195

Like
0Likes
Like

Posted 16 May 2012 - 02:33 PM

First of all, you already had a post where I posted this exact article. Continuing the discussion instead of hopping to another is preferable, because people can have more context.

frob has it right, more fundamental math classes in your future can only help you at this point.

EDIT:
Talked about context, just to ignore it myself. Woo.

Edited by KymikoLoco, 16 May 2012 - 04:35 PM.

### #5belfegor  Crossbones+   -  Reputation: 2817

Like
0Likes
Like

Posted 16 May 2012 - 02:41 PM

If you are struggling with basic trigonometry like cosines you probably ought to either wait until you have had more math classes in school, or get some time with a math tutor who can tutor you through trig, algebra, basic calculus, and linear algebra.

This is just my hobby and i missed this from school. Idiot. My best option is to find some online reference that is basic enough for me to understand and hopefully it isn't buried inside tons of "irrelevant text", at least for "basic" gamedev as i am not going to build my own physics engine or inventing new stuff, i just need the basics.
If you know some free resource that you think it suits me please share. Thanks.

### #6Álvaro  Crossbones+   -  Reputation: 17464

Like
1Likes
Like

Posted 16 May 2012 - 03:07 PM

First of all, you already had a post where I posted this exact article. Continuing the discussion instead of hopping to another is preferable, because people can have more context.

angle = acos( A dot B)

No.

Well, once you remove all the context in your quote, the answer became "no". But if you read the sentence just before the formula, you'll see that ||A||=||B||=1 in his case.

To the OP: The thing with the interval is a matter of naming conventions, but this one is very standard and you should get used to it. "The interval [0,pi]" means "the set of real numbers x such that 0<=x and x<=pi". They have to say this about the meaning of arc cosine because the cosine is not an injective function, so there are many numbers that are the arc cosine of a given number, and you have to pick one of them. Picking one between 0 and pi seems like the choice the matches the traditional intuitive notion of angle.

### #7belfegor  Crossbones+   -  Reputation: 2817

Like
0Likes
Like

Posted 16 May 2012 - 04:08 PM

And one more stupid question if you don't mind. Is there some table/legend, keyword to use for a search for those symbols like big 'E' with letters above and below, "pipes" between a vector |A| ...etc Whats the name for them so that i know what to search?

Big 'E'

Edited by belfegor, 16 May 2012 - 04:09 PM.

### #8Madhed  Crossbones+   -  Reputation: 3933

Like
1Likes
Like

Posted 16 May 2012 - 04:20 PM

The big "E" is actually the greek letter "Sigma" and it stands for "sum".
The name for these kind of sums is "series"

### #9frob  Moderators   -  Reputation: 33342

Like
1Likes
Like

Posted 16 May 2012 - 04:20 PM

And one more stupid question if you don't mind. Is there some table/legend, keyword to use for a search for those symbols like big 'E' with letters above and below, "pipes" between a vector |A| ...etc Whats the name for them so that i know what to search?

Big 'E'

The "Big E" is actually a Greek "S", shorthand for summation (addition) or series. They expanded it out for you on that equation on the next line.
The pipes are notation for magnitude, which you may already know as length, size, or absolute value.

I suggest you go find out what textbook your local school is using for trig, then for algebra, and work through them very carefully. Linear algebra and some Calculus would be highly recommended next, but there are books like "Mathematics for 3D Game Programmers" that work you up from algebra.

Very little of those books are "irrelevant text", and items that students believe are irrelevant tend to become gaps in knowledge later on.

Edited by frob, 16 May 2012 - 04:22 PM.

Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I occasionally write about assorted stuff.

### #10Madhed  Crossbones+   -  Reputation: 3933

Like
2Likes
Like

Posted 16 May 2012 - 04:27 PM

### #11belfegor  Crossbones+   -  Reputation: 2817

Like
0Likes
Like

Posted 17 May 2012 - 12:12 PM

I am reading "3d math primer for graphics and game development" book, and i have made simple project to practice on as i read.
I have made a arrow model with tail at origin and tip pointing 0 0 1 (forward).

So i can assume that basis vectors is this?:
right 1 0 0
up 0 1 0
forward 0 0 1

and then i take some arbitrary point to be my new target at witch arrow will point.

newForwardDir = targetPos - myPosition;

and now i want to buid new matrix so i need all other vectors transformed.

So i am thinking that new UP vector is:
newUPDir = newForwardDir cross oldForwardDir
right? yes/no?

And if so then:
newRightDIr = newUpDir cross newForwardDir
right?

Then i tried:
D3DXMATRIX mat;
D3DXMatrixIdentity(&mat);
mat._11 = rightDir.x;
mat._12 = rightDir.y;
mat._13 = rightDir.z;
mat._21 = upDir.x;
mat._22 = upDir.y;
mat._23 = upDir.z;
mat._31 = forwDir.x;
mat._32 = forwDir.y;
mat._33 = forwDir.z;

D3DDevice->SetTransform(D3DTS_WORLD, &mat);
arrowMesh->DrawSubset(0);
and it looks ok but i don't know am i right?

And my questions is :
1. As book says about cross product that it depends on order of vectors as a cross b is not same as b cross a as it will point in opposite directions, how should i know in witch order to set vectors as parameters?

2. How can i build a rot. matrix with D3DXMatrixRotationAxis as i don't know what to specify for rotation axis, what is it?
What about angle parameter for that function, is that a :
angle = acos( newForward dot oldForward )

Thanks for your patience.

### #12Álvaro  Crossbones+   -  Reputation: 17464

Like
0Likes
Like

Posted 17 May 2012 - 02:24 PM

You only have the direction that (0,0,1) should map to, but that's not enough information to determine the whole transformation. What you are doing breaks down if newForwardDir == oldForwardDir.

1. It depends on what you are using the cross product for. But this is usually not too hard to figure out if you think of examples.

2. If you already have a rotation matrix, I am sure you don't need to use D3DXMatrixRotationAxis. But if you ever need to compute the rotation axis, it is an eigenvector of the rotation matrix.

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS