How is this 'wy' equation for thick line segment derived?
1 Answer
The main part of it is simply Pythagoras's Theorem. The square root gives the length of the central line segment (which is the hypotenuse of a triangle formed by the change in x and change in y). The ratio between the hypotenuse and the change in x is the same as the ratio between the line width and the line width in y (they are similar triangles). Dividing by two is because $w_y$ is the half-width, not the full width. The -1 doesn't appear to make sense in a continuous context, so I assume it's to make sure the number of pixels is rounded down as part of the division. This prevents the line from jumping in thickness when it crosses a pixel boundary.