# Vector math question

Where can I find some good tootorials about 3D vector math? I wan’t to move a vertex in a diretion of some vector for, let say, 0.5 blender units but I have missed that lession in my school

simple

pythagoras works the same in 2d and 3d:

x^2 + y ^2 + z^2 = 0.5

the vector <A, B, C> defines the direction of the 0.5, thus:

A = D x
B = D y
C = D z

(where D is some constant)

and there you have it. 4 equations and 4 variables (x,y,z,D). Now solve for x,y,z and you will have the position you need to move in each direction.

As I’ve said I have missed that class
D is a constant? D is vector along witch a want to move vertex?

Damir: ok lets do it simple.

Say you have two locations, and you want one to move to the other. Then first you get the vector from the one you want to move to the point you want to move it to.

Now look for a function that normalises the vector. Normalising a vector means you make it exactly 1 unit long.

So now you have a vector that describes exactly in what direction you want to move, and it’s length is 1. Now you want to move it only 0.5 units, so multiply that vector by 0.5 (or however far you want it to move).

Then simply add the x,y & z of the vector to the original location of the object you want to move, and you have it’s new position.

Thanks macouno. Man, how dumb I can be… I have done exactly that in the first place. And I thought that I’m mistaking because i thought that Python gives me wrong results. In my freakin mind, magnitude of Vector(1,1,1) was 1

hm… what do you mean by magnitude…

isn’t the length of <1,1,1> = root(1+1+1) = root(3)

POVRAY docs also have some good information. Since I started learning about it vector math has become my favorite math. I highly recommend getting a firm grasp on vectors!

If at some point you want to make a transition from vectors to matrices there are some nice tutes from the game programming perspective floating around, and this:
http://ocw.mit.edu/OcwWeb/Mathematics/18-06Spring-2005/CourseHome/index.htm <- video lectures

Yes, magnitude is length. And you are right, length of [1,1,1] is sqrt(3) but actuall formula is sqrt(x^2 + y^2 + z^2) and I’ve forgot that. I haven’t worked on anything related to math for a long time so I’m a bit rusty I have missed that class with vectors, but I have always loved trigonometry

Kitsu, thanks for the tips, I’ll look in to that