fixed typos
This commit is contained in:
		
							
								
								
									
										20
									
								
								path.py
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								path.py
									
									
									
									
									
								
							| @@ -5,26 +5,20 @@ class Path: | |||||||
|     def __init__(self, points: list[Vec2], extra_data: list): |     def __init__(self, points: list[Vec2], extra_data: list): | ||||||
|         self.points: list[Vec2] = points |         self.points: list[Vec2] = points | ||||||
|         self.extra_data = extra_data |         self.extra_data = extra_data | ||||||
|         self.vecs: list[Vec2] = [] |         self.normals: list[Vec2] = [] | ||||||
|         self._init_vecs() |         self._init_normals() | ||||||
|  |  | ||||||
|     def _init_vecs(self) -> None: |     def _init_normals(self) -> None: | ||||||
|         for i in range(1, len(self.points) - 1): |         for i in range(1, len(self.points) - 1): | ||||||
|             pt1 = self.points[i-1] |             pt1 = self.points[i-1] | ||||||
|             pt2 = self.points[i] |             pt2 = self.points[i] | ||||||
|             pt3 = self.points[i+1] |             pt3 = self.points[i+1] | ||||||
|             d1 = pt1 - pt2 |             d1 = (pt1 - pt2).normalized() | ||||||
|             d2 = pt3 - pt2 |             d2 = (pt3 - pt2).normalized() | ||||||
|  |  | ||||||
|             l1 = d1.mag |             d = (d1 + d2).normalized() | ||||||
|             l2 = d2.mag |  | ||||||
|  |  | ||||||
|             d1 = d1.normalized() |  | ||||||
|             d2 = d1.normalized() |  | ||||||
|  |  | ||||||
|             d = d1 + d2 |  | ||||||
|             d = d.normalized() |  | ||||||
|             if d2.cross(d) < 0: |             if d2.cross(d) < 0: | ||||||
|                 d = -d |                 d = -d | ||||||
|  |  | ||||||
|             self.vecs.append(d) |             self.normals.append(d) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user