Top vertex of the triangle calculation


I have some problems on calculating the triangle vertex.

In the picture (attachment), I have two known vertex (x1,y1) and (x2,y2) and the height of the triangle (the red line). However, I want to calculate the top vertex of this triangle (x3,y3). Is there any methods to calculate it?

Is there any useful formula can help me to calculate it?

Another two attribute will be required for this.

  1. The distance of the Point Say C(x3, y3) from the line AB where, A(x1, y1), B(x2, y2)
  2. whether the point is on the left side of the line or on the right side.

Also it is assumed that the red line meets line AB at the mid point.

Thanks & Regards
Anirban Talukdar

Got an ans.

let the length of the line is l.

Vector AB (x2-x1, y2-y1).
Now vector perpendicular to AB (-(y2-y1), x2-x1);
Let say P is mid point of AB. P((x1+x2)/2, (y1+y2)/2)).
now C(x3, y3) will be P + Normalize(AB) * l.

Thanks & Regards

Thanks for your help.