mitchcurtis / slate

Pixel Art Editor
GNU General Public License v3.0
1.08k stars 104 forks source link

Take brush size into account when calculating line bounds. #89

Closed not-surt closed 5 years ago

mitchcurtis commented 5 years ago

Oooo, contributions! :D Thanks! I'll take a look when my brain is working.. bit late at the moment. :)

mitchcurtis commented 5 years ago

Thanks! From what I can see, this fixes the issue where the ends of the line are cut off? That means it partially fixes #7, coincidentally. :)

I understand everything except the square root part. Would you mind pushing an extra patch that adds a comment before that line explaining what the square root does there?

not-surt commented 5 years ago

sqrt(2) is just the ratio between the hypotenuse of a square and its side. A simplification of Pythagoras’ theorem. The bounds could be tighter by taking into account the specific rotation of the brush, but the sqrt(2) ensures it is big enough for any rotation.

mitchcurtis commented 5 years ago

Thanks!