I know that planar is not maintained anymore, but I thought I would mention the following, in case someone decides to use it.
When you define the same line using opposite direction vectors the comparison returns
False. For example line
In : from planar.py import Line In : l1 = Line((0, 0), (1, 1)) In : l2 = Line((0, 0), (-1, -1)) In : l1.almost_equals(l2) Out: False In : l1 == l2 Out: False
Something like this could fix it
def almost_equals(self, other): """ Return True if this line is approximately equal to another line, within precision limits.""" return (self.__class__ is other.__class__ and abs(self.offset - other.offset) < planar.EPSILON and (self.direction.almost_equals(other.direction) or self.direction.almost_equals(-other.direction)))