text: calculate displacements along axes
code: let dx = ( ( l / Math . sqrt ( 1 + ( m * m ) ) ) * 0.5 ) ; let dy = m * dx ; a . x = p . x - dx ; a . y = p . y - dy ; d . x = p . x + dx ; d . y = p . y + dy ; b . x = q . x - dx ; b . y = q . y - dy ; c . x = q . x + dx ; c . y = q . y + dy ; } document . write ( a . x + " " + a . y + " " + b . x + " " + b . y + " " + c . x + " " + c . y + " " + d . x + " " + d . y + " " ) ; }