Given a start and end point, how can I constrain the end point so the resulting line segment is horizontal, vertical, or 45 degrees?
- by GloryFish
I have a grid of letters. The player clicks on a letter and drags out a selection. Using Bresenham's Algorithm I can create a line of highlighted letters representing the player's selection.
However, what I really want is to have the line segment be constrained to 45 degree angles (as is common for crossword-style games).
So, given a start point…