First enter the length of the line, then in what direction the line will goes. The black line is the line himself, and the red rectangle is a rectangle that is perfectly around the line.
With sin and cos I calculated the width and the height of a line oriented in a specific direction. I have two reasons to do that. First, it is much more precise (if I did with the x and y-cordinate, it would be rounded at the nearest unite). Secondly, you can calculate before even moving.