Setting a vector to another magnitude

  • Thread starter Thread starter wraithseeker
  • Start date Start date
  • Tags Tags
    Magnitude Vector
Click For Summary
Setting a vector to a new magnitude involves calculating its current length and adjusting its components proportionally. The process starts by determining the vector's length using the formula length = Sqrt(x*x + y*y + z*z). To change the vector's magnitude, divide the desired new length by the current length and multiply all velocity components by this factor. This method maintains the vector's direction while scaling its magnitude. Understanding this process is crucial for applications in physics and computer graphics where vector manipulation is essential.
wraithseeker
Messages
28
Reaction score
0
When you set it, initially I have to do

length = Sqrt(x*x+y*y*z*z)
length = newlength/length
set all the velocities to multiply by length

I am wondering what is this for?

length = newlength/length
 
Science news on Phys.org
newlength/oldlength is the fraction by which the length has to increase. The length of the new vector will be
|| oldvector * newlength / oldlength || = || oldvector || * newlength / oldlength = oldlength * newlength / oldlenght.

Alternatively, you can look at it this way: if you have a vector v, first divide it by its length to make a unit vector u (in the same direction but with length 1). Then multiply u by the length you want it to have to get the new vector:
v' = u * newlength = (v / oldlength) * newlength = v * (newlength / oldlength)
where oldlength is the length of v (sqrt(x^2 + y^2 + z^2)).
 
Well, you're talking about a vector, so I assume direction is important. It would be easier to change leingths of individual cartesian components by the desired amount. In cylindrical and sphercal, you merely change r.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
967
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 11 ·
Replies
11
Views
1K
Replies
7
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 9 ·
Replies
9
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K