can_be_merged_with's implementation could be replaced by:
def can_be_merged_with(self, other):
if self.__class__ is other.__class__ and \
self.center_point().almost_equal_to(other.center_point(), 5) and \
self.radius() == other.radius():
return (self.end_heading() == other.start_heading() and
self.end_point().almost_equal_to(other.start_point(), 5)) or \
(other.end_heading() == self.start_heading() and
other.end_point().almost_equal_to(self.start_point(), 5))
In that case, merge's implementation should be changed to merge in one order or the other depending on which order they can be appended one to the other.
can_be_merged_with's implementation could be replaced by:
In that case, merge's implementation should be changed to merge in one order or the other depending on which order they can be appended one to the other.
Here are some tests: