mirror of
https://github.com/enzet/map-machine.git
synced 2025-08-06 10:09:52 +02:00
Clean code; ignore offset error.
This commit is contained in:
parent
844905caa4
commit
88dd7f4426
1 changed files with 4 additions and 5 deletions
|
@ -60,7 +60,7 @@ class Polyline:
|
|||
if parallel_offset
|
||||
else self.points
|
||||
)
|
||||
except ValueError:
|
||||
except (ValueError, NotImplementedError):
|
||||
points = self.points
|
||||
|
||||
return (
|
||||
|
@ -124,6 +124,8 @@ class Segment:
|
|||
self.point_1: np.ndarray = point_1
|
||||
self.point_2: np.ndarray = point_2
|
||||
|
||||
self.y = ((self.point_1 + self.point_2) / 2.0)[1]
|
||||
|
||||
difference: np.ndarray = point_2 - point_1
|
||||
vector: np.ndarray = difference / np.linalg.norm(difference)
|
||||
if vector[0] > 0:
|
||||
|
@ -133,7 +135,4 @@ class Segment:
|
|||
)
|
||||
|
||||
def __lt__(self, other: "Segment") -> bool:
|
||||
return (
|
||||
((self.point_1 + self.point_2) / 2.0)[1]
|
||||
< ((other.point_1 + other.point_2) / 2.0)[1]
|
||||
) # fmt: skip
|
||||
return self.y < other.y
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue