Skip to content

Commit 4389236

Browse files
committed
fix typo
1 parent 9d9284c commit 4389236

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

src/compas/geometry/triangulation_earclip.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Ear(object):
1818
Coordinates of the vertex of the Ear triangle.
1919
next : int
2020
Index of the next vertex of the Ear triangle.
21-
prew : int
21+
prev : int
2222
Index of the previous vertex of the Ear triangle.
2323
neighbour_coords : list
2424
Coordinates of the next and previous vertices of the Ear triangle.
@@ -32,10 +32,10 @@ def __init__(self, points, indexes, ind):
3232
index_in_indexes_arr = indexes.index(ind)
3333
self.next = indexes[(index_in_indexes_arr + 1) % length]
3434
if index_in_indexes_arr == 0:
35-
self.prew = indexes[length - 1]
35+
self.prev = indexes[length - 1]
3636
else:
37-
self.prew = indexes[index_in_indexes_arr - 1]
38-
self.neighbour_coords = [points[self.prew], points[self.next]]
37+
self.prev = indexes[index_in_indexes_arr - 1]
38+
self.neighbour_coords = [points[self.prev], points[self.next]]
3939

4040
def is_inside(self, point):
4141
"""Check if a given point is inside the triangle formed by the Ear.
@@ -120,7 +120,7 @@ def get_triangle(self):
120120
List of vertex indices forming the Ear triangle.
121121
122122
"""
123-
return [self.prew, self.index, self.next]
123+
return [self.prev, self.index, self.next]
124124

125125

126126
class Earcut(object):
@@ -168,7 +168,7 @@ def add_ear(self, new_ear):
168168
169169
"""
170170
self.ears.append(new_ear)
171-
self.neighbours.append(new_ear.prew)
171+
self.neighbours.append(new_ear.prev)
172172
self.neighbours.append(new_ear.next)
173173

174174
def find_ears(self):
@@ -229,16 +229,16 @@ def triangulate(self):
229229
current = self.ears.pop(0)
230230

231231
indexes.remove(current.index)
232-
self.neighbours.remove(current.prew)
232+
self.neighbours.remove(current.prev)
233233
self.neighbours.remove(current.next)
234234

235235
self.triangles.append(current.get_triangle())
236236

237-
# Check if prew and next vertices form new ears
238-
prew_ear_new = Ear(self.vertices, indexes, current.prew)
237+
# Check if prev and next vertices form new ears
238+
prev_ear_new = Ear(self.vertices, indexes, current.prev)
239239
next_ear_new = Ear(self.vertices, indexes, current.next)
240-
if prew_ear_new.validate(self.vertices, indexes, self.ears) and prew_ear_new.index not in self.neighbours:
241-
self.add_ear(prew_ear_new)
240+
if prev_ear_new.validate(self.vertices, indexes, self.ears) and prev_ear_new.index not in self.neighbours:
241+
self.add_ear(prev_ear_new)
242242
continue
243243
if next_ear_new.validate(self.vertices, indexes, self.ears) and next_ear_new.index not in self.neighbours:
244244
self.add_ear(next_ear_new)
@@ -270,8 +270,6 @@ def earclip_polygon(polygon):
270270
If no more ears were found for triangulation.
271271
272272
"""
273-
274-
# Orient the copy of polygon points to XY plane.
275273
from compas.geometry import Frame # Avoid circular import.
276274
from compas.geometry import Plane # Avoid circular import.
277275
from compas.geometry import Transformation # Avoid circular import.

0 commit comments

Comments
 (0)