1
$\begingroup$

I have two three component vectors, lets call them $\vec x$ and $\vec y$.

I want to find $\vec z$ such that $\|\vec z\| = \|\vec x\|$ and the $x$ and $y$-orientation of $\vec z$ equals the x and y-orientation of $\vec y$.

EDIT: And the z-component contribution in $\vec x$ is matched in $\vec z$.

Basically I want to find the vector for an object that's falling just as fast who's heading is different. Is this possible?

$\endgroup$
  • $\begingroup$ By "x and y-orientation of $\vec z$ equals the x and y-orientation of $\vec y$" you mean that that $\vec z$ points in the same direction as $\vec y$? Then it should be $\frac{||x||}{||y||}\vec y$...maybe $\pm$ if you allow the oposite direction as well... $\endgroup$ – draks ... Jun 18 '15 at 13:11
  • $\begingroup$ @draks... Yes I do mean that $\vec z$ will point in the same direction as $\vec y$ within the xy-plane, but I don't understand your equation. $\endgroup$ – Jonathan Mee Jun 18 '15 at 13:13
  • $\begingroup$ I normalize $\vec y$ by dividing it by its norm $||\vec y||$ and then a scale it to the desired length by multiplying it with $||\vec x||$... $\endgroup$ – draks ... Jun 18 '15 at 13:14
  • 1
    $\begingroup$ oh I forgot the third dimension, let me think...[thinking]...I thought and it it should look like this$\frac{||\vec x||}{\sqrt{y_1^2+y_2^2+a^2}}\pmatrix{y_1\\y_2\\a}$... $\endgroup$ – draks ... Jun 18 '15 at 13:16
1
$\begingroup$

If $\vec y=\pmatrix{y_1\\y_2\\y_3}$, then it should look like this: $$ \vec z=\sqrt{\frac{x_1^2+x_2^2+x_3^2}{y_1^2+y_2^2+a^2}}\pmatrix{y_1\\y_2\\a}; $$ it has $x$ and $y$ components of $\vec y$ and the length of $||\vec x||$. Now choose $$ a\sqrt{\frac{x_1^2+x_2^2+x_3^2}{y_1^2+y_2^2+a^2}}=x_3 $$ and solve it for $a$...

$\endgroup$
  • $\begingroup$ I'm unclear what $a$ is, is $a = x_3$? Nope, that doesn't make sense cause $x_3$ is not scaled to match $y$... $\endgroup$ – Jonathan Mee Jun 18 '15 at 13:45
  • $\begingroup$ @JonathanMee $a$ is a free parameter... $\endgroup$ – draks ... Jun 18 '15 at 13:48
  • $\begingroup$ What I think I'm getting is that: $$z_1 = \frac{||\vec x||}{\sqrt{y_1^2+y_2^2+a^2}}y_1$$ and: $$z_2 = \frac{||\vec x||}{\sqrt{y_1^2+y_2^2+a^2}}y_2$$ and: $$z_3 = x_3$$ but I still can'y use that to find $\vec z$ cause I don't know what $a$ is. $\endgroup$ – Jonathan Mee Jun 18 '15 at 13:55
  • $\begingroup$ @JonathanMee any vector of the above form has the length you asked for and it points along $x$ and $y$ as you requested; irrespective of $z_3$, which I called $a$. I changed that if this was too confusing... $\endgroup$ – draks ... Jun 18 '15 at 14:00
  • $\begingroup$ So I've posted an answer below, it seems like I just need to scale the xy-components of $\vec y$ and then stomp the z-component. Which seems like it should give identical results to you're equation, but the two are certainly not mathematically equal. I think it's because your messes up the proportions. For example if I have $\vec x = 1\mathbf i + 1\mathbf j + 2\mathbf k$ and $\vec y = 10\mathbf i + 10\mathbf j + 13\mathbf k$ your equation will significantly decrease the z contribution of the resulting vector. $\endgroup$ – Jonathan Mee Jun 18 '15 at 14:59
0
$\begingroup$

You can easily find this vector by scaling the z-component of $\vec x$ and then just using it directly in $\vec y$'s z-component to form $\vec z$.

The modifier you'll want to use is $x_3$ scaled by the xy-size of $\vec x$ over the xy-size of $\vec y$: $$z_3 = x_3\sqrt{\frac{y_1^2 + y_2^2}{x_1^2 + x_2^2}}$$

Then just set $z_1 = y_1$ and $z_2 = y_2$ and you have your vector!

To scale $\vec z$ such that $\|\vec z\| = \|\vec x\|$ simply set $\vec z$ to $\hat z\|\vec x\|$.

$\endgroup$
  • $\begingroup$ Why to fix the $z$ component with the value of $x_3$? That's not necessary, it's just one example. Set $z_3=x_3$ in my answer to recover yours as a special case... $\endgroup$ – draks ... Jun 19 '15 at 6:30
  • $\begingroup$ @draks... That's just the thing. I don't know how large to choose it in your code. I need a ratio between the xy-components of $\vec x$ and $\vec y$ to know how to choose how large it is. In the example I gave in the comments of your question your equation will give: $4.7\mathbf i + 4.7\mathbf j + 0.8\mathbf k$ if you just directly plug in $x_3$. My answer will give: $.1\mathbf i + .1\mathbf j + 2\mathbf k$... Stink, neither equation works. I need to refactor... $\endgroup$ – Jonathan Mee Jun 19 '15 at 10:31
  • $\begingroup$ See, I normalize any of my vectors (irrespective of $z_3$) to unit length of $1$ (by division with the norm) and then I multiply by $||\vec x||$... $\endgroup$ – draks ... Jun 19 '15 at 10:36
  • $\begingroup$ @draks... Looking at my original question I see how I didn't clearly specify what I wanted. I've edited. If you can tell me how to do that in your equation I'm ready, I just currently don't see how. $\endgroup$ – Jonathan Mee Jun 19 '15 at 10:42
  • $\begingroup$ Done; have a look... $\endgroup$ – draks ... Jun 19 '15 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.