01-A Relative Position Vectors

Vectors

  • Draw a set of \(x,y,z\) coordinate axes with each axis ranging from -10m to +10m.
  • Define a vector r1 given by \(\overrightarrow{r_1} = <4, 6, 2>\) m.
  • Draw a small blue sphere of radius 0.5 m centered at \(\overrightarrow{r_1}\) and draw a blue arrow from the origin to the location of this sphere.
  • Define a second vector r2 given by \(\overrightarrow{r_2} = <-5, -4, 7>\) m.
  • Draw a red sphere of radius 0.5 m centered at \(\overrightarrow{r_2}\) and draw a red arrow from the origin to the location of this sphere.
  • Define a relative position vector \(\overrightarrow{r_{21}} = \overrightarrow{r_2} – \overrightarrow{r_1}\) named r21 which describes the position of the red ball relative to the blue ball.
  • Draw a cyan arrow that shows the position of the red ball relative to the blue ball.
  • Compute the magnitude and direction of the relative position vector and print the relative position vector both in terms of its components and then as the product of its magnitude and a unit vector.
  • Your code should be written in a manner such that either r1 or r2 can be changed in only one location in your code and the corresponding sphere and arrow (vector) will change appropriately.