# Trying to offset vector

**URL:** <https://discourse.processing.org/t/trying-to-offset-vector/23304>\
**Category:** Project Guidance\
**Created:** [August 17, 2020, 7:55am UTC](https://discourse.processing.org/t/trying-to-offset-vector/23304 "2020-08-17T07:55:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TimoL](https://avatars.discourse-cdn.com/v4/letter/t/9fc29f/32.png) [@TimoL](https://discourse.processing.org/u/TimoL)\
**Post date:** [August 17, 2020, 7:55am UTC](https://discourse.processing.org/t/trying-to-offset-vector/23304/1 "2020-08-17T07:55:29Z")

</div>

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](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/bb54dfef73c4b63bdcc15b979bbcfe1e85c062bc.jpeg)

I can’t figure out the method…

any help?

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [August 17, 2020, 10:59am UTC](https://discourse.processing.org/t/trying-to-offset-vector/23304/2 "2020-08-17T10:59:47Z")

</div>

Hello,

Think about how you would offset a line between 2 points:  
[https://processing.org/reference/line\_.html](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/](https://processing.org/)

Another resource:  
[https://natureofcode.com/book/](https://natureofcode.com/book/)

[https://www.mathsisfun.com/algebra/vectors.html](https://www.mathsisfun.com/algebra/vectors.html)

`:)`

---

<div class="post-metadata">

**Author:** ![TimoL](https://avatars.discourse-cdn.com/v4/letter/t/9fc29f/32.png) [@TimoL](https://discourse.processing.org/u/TimoL)\
**Post date:** [August 23, 2020, 6:14am UTC](https://discourse.processing.org/t/trying-to-offset-vector/23304/3 "2020-08-23T06:14:16Z")

</div>

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

sometime I have a mind blank… Thanks for the help 🙂
