• Support PF! Buy your school textbooks, materials and every day products Here!

How to Change a Horizontal Vector to Move in a 45 degree angle

  • Thread starter Loppyfoot
  • Start date
  • #1
194
0

Homework Statement


I am using vPython, and object moves in a +x direction with a vector of <1e7,0,0>m. I need to now change the vector so that it now moves in the same +x direction, but also moving in the northeast direction at an angle of 45 degrees.

The Attempt at a Solution


I attempted <1e7,1e7,0>, and it looks similar to what I need, but I don't know if it is exact or correct.

Thanks for your help.
 

Answers and Replies

  • #2
gneill
Mentor
20,781
2,759

Homework Statement


I am using vPython, and object moves in a +x direction with a vector of <1e7,0,0>m. I need to now change the vector so that it now moves in the same +x direction, but also moving in the northeast direction at an angle of 45 degrees.

The Attempt at a Solution


I attempted <1e7,1e7,0>, and it looks similar to what I need, but I don't know if it is exact or correct.

Thanks for your help.
That will depend upon what vPython thinks the < , , > item is. Is it a velocity vector, with the individual parameters specifying the speed in the x,y,z directions? If so, and you want to keep the speed the same but change the direction, you want to have

[tex]speed = \sqrt{vx^2 + vy^2 + vz^2}[/tex]

If you're dealing with just the x and y directions (planar motion), then you can set your speed and direction as:

[tex] vx = speed \cdot cos(\theta)[/tex]
[tex] vy = speed \cdot sin(\theta)[/tex]

where [tex]\theta[/tex] is the desired direction angle, and use these values as the parameters.

Putting the same value for both the x and y parameters gave you a 45 degree angle, but probably increased the overall speed by a factor of [tex]\sqrt{2}[/tex]
 
  • #3
194
0
Ok, I get it, and I got it working. Thanks for your help.
 
  • #4
194
0
Where do you get the formula:
vx = speed * sin (45)?

Thanks.
 
  • #5
gneill
Mentor
20,781
2,759
Where do you get the formula:
vx = speed * sin (45)?

Thanks.
That's vx = speed * cos(45)

It's basic trigonometry for a right-angle triangle. Vectors in the x and y directions add like the sides of a right angle triangle to form the hypotenuse. The trigonometric functions, sine and cosine, encapsulate the relationships between the angle and the ratios of the lengths of the sides to the hypotenuse.
 
  • #6
194
0
Ok, So the x-component is 1e7cos(45), where the y-component is 1e7sin(45), so the hypotenuse is the vector that makes up both of these components, which allows the object to move in the direction that is 45 degrees from the horizontal.

Is that a decent understanding? Thanks for your help.
 
  • #7
gneill
Mentor
20,781
2,759
That's fine. You're good to go!
 

Related Threads for: How to Change a Horizontal Vector to Move in a 45 degree angle

Top