sightmachine/SimpleCV — pull request #439 by polart (2013-04-21 16:43:09+00:00)
Title: Crop the line to image edges method in Line class.

To Line class added method cropToImageEdges().
Endpoints of line that lies outside of image will be cropped to image's edges.
With method parameter "extend=True" endpoints that lies inside image will be extended to the edges of image.

Usage:
```python
img = Image('lenna')
l1 = Line(img, ((-100, -30), (300, 112))).cropToImageEdges()
# return line with endpoints ((0, 6), (300, 112))
l2 = Line(img, ((-100, -30), (300, 112))).cropToImageEdges(extend=True)
# return line with endpoints ((0, 6), (512, 187))
````

Also corrected bresenham_line method in ImageClass. In old version if endpoints of line were outside image than they just set to the image's edges without saving the slope of the line. Now it use cropToImageEdges() method for crop the line.