Searching for a vector opposite to another?

I need to know how to find the vector opposite to the other, but the second vector is not necessarily the same as the first, but the direction is the opposite. Example:

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

Basically, if I have coordinates A (-150,150), and I want B to be opposite and only 2, I would like to get B (-200, -150). What I'm doing is an application that can draw cubic shapes of bezier, and I noticed that there are a lot of them, there are bezier handles and a change in one handle that makes the other move too. How can I do that?

thank

+3
source share
2 answers

It is simple, really.

B = -1/2 * AOr B.x = -1/2 * A.x, B.y = -1/2 * A.y, B.z = -1/2 * A.z. This speaks of vectors, by the way. You want to change the result. The formula is dead simple. What am I missing?

EDIT

Your application knows the location of the red dot (shorten it as vector R). Your application also knows the vector A. It should find the vector B, which is on the same line as AR, on the other hand, R as A, and such as A is twice as large B. Well, in this case:

  • Temporarily compute vector V = (A - R)
  • Now (it's easy :)) B = R - 0.5 * V.

It's simple, I promise. Uppercase letters are vectors, which are usually 2-tuples or 3-tuples of real numbers (depending on whether you work in 2D or 3D).

In fact, this is not enough. Have questions?

+3

Source: https://habr.com/ru/post/1756394/


All Articles