TimoL
August 17, 2020, 7:55am
1
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)
I can’t figure out the method…
any help?
1 Like
glv
August 17, 2020, 10:59am
2
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
TimoL
August 23, 2020, 6:14am
3
oh jeez. after posting this it suddenly dawned on me.
sometime I have a mind blank… Thanks for the help
2 Likes