Find direction vector is in

Hello,

They are both heading in the same direction.

Take a look here for some resources:

It helps to draw vectors when working with them:

void setup() 
  {
  size(300, 300);
  background(255);
  PVector a = new PVector (50, 50);
  PVector b = new PVector (250, 250);
  stroke(255, 0, 0);
  strokeWeight(5);
  line(0, 0, a.x, a.y);
  stroke(0, 255, 0);
  strokeWeight(2);
  line(0, 0, b.x, b.y);
  }

image

:)

1 Like