Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding vector opposite to another?

I need to know how to find a vector opposite to another, but the second vector is not necessarily the same magnitude as the first, but the direction is opposite. Ex:

I made a small diagram :) alt text http://img688.imageshack.us/img688/5394/prettydiagram.png

Basically if I have the coordinates of A(-150,150) and I want B to be opposite, and have a magnitude of only 2, I would want to obtain B(-200,-150). What I am doing is making an application that can draw cubic bezier shapes and I noticed with lots of these, there are bezier handles and modifying one handle cause the other one to move too. How could this be done?

Thanks

like image 634
jmasterx Avatar asked Oct 16 '25 14:10

jmasterx


1 Answers

All you have to do is calculate the unit vector of the original vector by dividing each component by the magnitude of the vector and then apply a rotational transformation about a 180 degree angle.

The rotational transformation matrix looks like this:

alt text
(source: equationsheet.com)

Apply the transformation like this:

alt text
(source: equationsheet.com)

The primed vector is now the unit vector pointing in the direction you want. You can scale it by any magnitude you wish.

In your special case the angle is 180 degrees. You know that the cosine of 180 is -1 and the sine is zero, so the matrix is simple:

alt text
(source: equationsheet.com)

This makes it clear as day: All you have to do is reverse the signs of the two unit vector components and you have your answer.

like image 105
duffymo Avatar answered Oct 18 '25 05:10

duffymo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!