Trying to offset vector

Im trying to offset a vector.

Im sure this is really easy, but Im struggling with the maths.

Basically I have 2 vectors: A & B. (Green & red)
Using them I am creating a new Vector: C (blue)

My goal is to ‘offset’ vector C so that it is centred to the origin. (Magenta)
vectors

I can’t figure out the method…

any help?

1 Like

Hello,

Think about how you would offset a line between 2 points:
https://processing.org/reference/line_.html

And then apply that thinking to your question with PVectors.

What is vector C? A+B or A-C with an offset added?
The offset can be a vector added to the starting point and ending point of C.
If you want to line it up to the middle of C you will have to consider that as well…

Do a search for PVectors here:
https://processing.org/

Another resource:
https://natureofcode.com/book/

https://www.mathsisfun.com/algebra/vectors.html

:)

1 Like

oh jeez. after posting this it suddenly dawned on me.

sometime I have a mind blank… Thanks for the help :slight_smile:

2 Likes