Get Third vertex of triangle Let us suppose that we have two vertex a(x,y) and b(x1,y1) then
just pass two points to below given function and it will return C(X,Y) i.e. third vertex.
function getPointC(a, b)
{
var pivotPoint;
if (b.x > a.x)
{
pivotPoint = a;
}
else
{
pivotPoint = b;
}
var dx = b.x - a.x;
var dy = b.y - a.y;
var lengthAB = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
var angleAB = Math.atan(dy/dx);
var c = new Object();
c.x = lengthAB*Math.cos(angleAB + 60*Math.PI/180) + pivotPoint.x;
c.y = lengthAB*Math.sin(angleAB + 60*Math.PI/180) + pivotPoint.y;
return c;
}