Fixed mistyped method.

The type error was pointed out by @adsharma in #4.
This commit is contained in:
Michael Whittaker 2021-03-31 12:34:55 -07:00
parent 1b533aac0c
commit 457f5d1703

View file

@ -33,11 +33,11 @@ class Segment:
assert self.l.x <= x <= self.r.x assert self.l.x <= x <= self.r.x
return self.slope() * (x - self.l.x) + self.l.y return self.slope() * (x - self.l.x) + self.l.y
def approximately_equal(self, other: 'Segment') -> float: def approximately_equal(self, other: 'Segment') -> bool:
return (math.isclose(self.l.y, other.l.y, rel_tol=1e-5) and return (math.isclose(self.l.y, other.l.y, rel_tol=1e-5) and
math.isclose(self.r.y, other.r.y, rel_tol=1e-5)) math.isclose(self.r.y, other.r.y, rel_tol=1e-5))
def compatible(self, other: 'Segment') -> float: def compatible(self, other: 'Segment') -> bool:
return self.l.x == other.l.x and self.r.x == other.r.x return self.l.x == other.l.x and self.r.x == other.r.x
def slope(self) -> float: def slope(self) -> float: