I took this out for a spin:
PVector A;
PVector B;
PVector C;
float aA = 225; // change this to a number below 180 degrees
float aB = 135;
float angle = 135;
float averageHeading;
float theta;
void setup ()
{
size (300, 300);
A = new PVector(0, 0);
B = new PVector(0, 0);
C = new PVector(0, 0);
}
void draw()
{
background(200);
stroke(0);
noFill();
circle(width/2, height/2, width);
theta+= TAU/360;
pushMatrix();
translate(width/2, height/2);
A = PVector.fromAngle(theta);
B = PVector.fromAngle(radians(aB));
A.setMag(150);
B.setMag(150);
stroke(255, 0, 0);
line(0, 0, A.x, A.y);
line(0, 0, B.x, B.y);
//averageHeading = A.heading() + B.heading();
//averageHeading = averageHeading/2;
//C = PVector.fromAngle(averageHeading);
//C.setMag(150);
C.set(A.add(B));
stroke(255, 0, 255);
line(0, 0, C.x, C.y);
popMatrix();
}
I will leave the rest with you.
:)