Third coordinate
let x3 = parseInt ( ( d1 + d2 - d3 ) / 2 ) ; let y3 = parseInt ( ( d2 + d3 - d1 ) / 2 ) ; document . write ( " " + x1 + " " + y1 + " " + x2 + " " + y2 + " " + x3 + " " + y3 + " " ) ; }