calculate displacements along axes
float dx = ( l / sqrt ( 1 + ( m * m ) ) ) * 0.5 ; float 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 ; } cout << a . x << " , ▁ " << a . y << " ▁ n " << b . x << " , ▁ " << b . y << " n " ; << c . x << " , ▁ " << c . y << " ▁ n " << d . x << " , ▁ " << d . y << " nn " ; }