def __eq__(self, other):
"""Test equality of self with other.
Two fuzzy points are equals if the midpoint of one of them is in the
area of the other.
"""
point = None
if isinstance(other, str) is True:
point = sppasFuzzyPoint.parse(other)
elif isinstance(other, tuple) is True:
if len(other) in (2, 3):
point = sppasFuzzyPoint((other[0], other[1]))
if len(other) == 3:
point.set_radius(other[2])
elif isinstance(other, sppasFuzzyPoint) is True:
point = other
if point is None:
raise AnnDataTypeError('sppasFuzzyPoint', 'tuple(int,int)')
other_x, other_y = point.get_midpoint()
other_r = point.get_radius()
if other_r is None:
return self.contains((other_x, other_y))
if self.contains((other_x - other_r, other_y - other_r)) is True:
return True
if self.contains((other_x - other_r, other_y + other_r)) is True:
return True
if self.contains((other_x + other_r, other_y - other_r)) is True:
return True
if self.contains((other_x + other_r, other_y + other_r)) is True:
return True
return False