# Commits

committed d688699

Remove definition of function "left_of_line" from geoalg.convexhull.py and
import it from geoalg.base.py

• Participants
• Parent commits 3f9cfb6
• Branches default

# File geoalg/convexhull.py

` `
` __all__ = ['ConvexHull']`
` `
`+from geoalg import left_of_line`
`+`
` class ConvexHull(object):`
`     def __init__(self, points):`
`         self._points = ConvexHull._construct(points)`
`             lower_hull = convex_hull(lower_hull)`
`         upper_hull.extend(lower_hull[1:-1])`
`         return upper_hull`
`-`
`-def left_of_line(point, p1, p2):`
`-    """ True if the point self is left of the line p1 -> p2`
`-    """`
`-    # check if a and b are on the same vertical line`
`-    if p1[0] == p2[0]:`
`-        # compute # on which site of the line self should be`
`-        should_be_left = p1[1] < p2[1]`
`-        if should_be_left:`
`-            return point[0] < p1[0]`
`-        else:`
`-            return point[0] > p1[0]`
`-    else:`
`-        # get pitch of line`
`-        pitch = (p2[1] - p1[1]) / (p2[0] - p1[0])`
`-`
`-        # get y-value at c's x-position`
`-        y = pitch * (point[0] - p1[0]) + p1[1]`
`-`
`-        # compute if point should be above or below the line`
`-        should_be_above = p1[0] < p2[0]`
`-        if should_be_above :`
`-            return point[1] > y`
`-        else:`
`-            return point[1] < y`