implemented segments

This commit is contained in:
2024-04-15 23:14:18 +02:00
parent 68a9d853c5
commit 3784973647
3 changed files with 48 additions and 9 deletions

View File

@@ -9,6 +9,8 @@ class Path:
self._init_normals()
def _init_normals(self) -> None:
pt0 = self.points[0]
self.normals.append(Vec2(pt0.y, -pt0.x))
for i in range(1, len(self.points) - 1):
pt1 = self.points[i-1]
pt2 = self.points[i]
@@ -22,3 +24,6 @@ class Path:
d = -d
self.normals.append(d)
ptl = self.points[-1]
self.normals.append(Vec2(ptl.y, -ptl.x))