@@ -178,15 +178,15 @@ cdef inline format_pmesh_face(face_c face, int has_color):
178
178
# Naive triangulation
179
179
all = []
180
180
if has_color == 1 :
181
- for i from 1 <= i < face.n - 1 :
181
+ for i in range ( 1 , face.n - 1 ) :
182
182
r = sprintf_5i(ss, " %d \n %d \n %d \n %d \n %d " , has_color * 4 ,
183
183
face.vertices[0 ],
184
184
face.vertices[i],
185
185
face.vertices[i + 1 ],
186
186
face.vertices[0 ])
187
187
PyList_Append(all , PyBytes_FromStringAndSize(ss, r))
188
188
else :
189
- for i from 1 <= i < face.n - 1 :
189
+ for i in range ( 1 , face.n - 1 ) :
190
190
r = sprintf_6i(ss, " %d \n %d \n %d \n %d \n %d \n %d " , has_color * 4 ,
191
191
face.vertices[0 ],
192
192
face.vertices[i],
@@ -369,16 +369,16 @@ cdef class IndexFaceSet(PrimitiveObject):
369
369
370
370
cdef Py_ssize_t i
371
371
cdef Py_ssize_t index_len = 0
372
- for i from 0 <= i < len (faces):
372
+ for i in range ( len (faces) ):
373
373
index_len += len (faces[i])
374
374
375
375
self .realloc(len (point_list), len (faces), index_len)
376
376
377
- for i from 0 <= i < self .vcount:
377
+ for i in range ( self .vcount) :
378
378
self .vs[i].x, self .vs[i].y, self .vs[i].z = point_list[i]
379
379
380
380
cdef int cur_pt = 0
381
- for i from 0 <= i < self .fcount:
381
+ for i in range ( self .fcount) :
382
382
self ._faces[i].n = len (faces[i])
383
383
self ._faces[i].vertices = & self .face_indices[cur_pt]
384
384
if self .global_texture:
@@ -517,15 +517,15 @@ cdef class IndexFaceSet(PrimitiveObject):
517
517
cdef int * point_counts = < int * > check_calloc(self .vcount * 2 + 1 , sizeof(int ))
518
518
# For each vertex, get number of faces
519
519
cdef int * running_point_counts = & point_counts[self .vcount]
520
- for i from 0 <= i < self .fcount:
520
+ for i in range ( self .fcount) :
521
521
face = & self ._faces[i]
522
522
total += face.n
523
- for j from 0 <= j < face.n:
523
+ for j in range ( face.n) :
524
524
point_counts[face.vertices[j]] += 1
525
525
# Running used as index into face list
526
526
cdef int running = 0
527
527
cdef int max = 0
528
- for i from 0 <= i < self .vcount:
528
+ for i in range ( self .vcount) :
529
529
running_point_counts[i] = running
530
530
running += point_counts[i]
531
531
if point_counts[i] > max :
@@ -540,9 +540,9 @@ cdef class IndexFaceSet(PrimitiveObject):
540
540
raise
541
541
sig_on()
542
542
memset(point_counts, 0 , sizeof(int ) * self .vcount)
543
- for i from 0 <= i < self .fcount:
543
+ for i in range ( self .fcount) :
544
544
face = & self ._faces[i]
545
- for j from 0 <= j < face.n:
545
+ for j in range ( face.n) :
546
546
v = face.vertices[j]
547
547
point_faces[running_point_counts[v]+ point_counts[v]] = face
548
548
point_counts[v] += 1
@@ -557,7 +557,7 @@ cdef class IndexFaceSet(PrimitiveObject):
557
557
while start < self .vcount:
558
558
ix = self .vcount
559
559
# Find creases
560
- for i from 0 <= i < self .vcount - start:
560
+ for i in range ( self .vcount - start) :
561
561
faces = & point_faces[running_point_counts[i]]
562
562
any = 0
563
563
for j from point_counts[i] > j >= 1 :
@@ -582,17 +582,17 @@ cdef class IndexFaceSet(PrimitiveObject):
582
582
raise
583
583
ix = self .vcount
584
584
running = 0
585
- for i from 0 <= i < self .vcount - start:
585
+ for i in range ( self .vcount - start) :
586
586
if point_counts[i] != running_point_counts[i+ 1 ] - running_point_counts[i]:
587
587
# We have a new vertex
588
588
self .vs[ix] = self .vs[i+ start]
589
589
# Update the point_counts and point_faces arrays for the next time around.
590
590
count = running_point_counts[i+ 1 ] - running_point_counts[i] - point_counts[i]
591
591
faces = & point_faces[running]
592
- for j from 0 <= j < count:
592
+ for j in range ( count) :
593
593
faces[j] = point_faces[running_point_counts[i] + point_counts[i] + j]
594
594
face = faces[j]
595
- for k from 0 <= k < face.n:
595
+ for k in range ( face.n) :
596
596
if face.vertices[k] == i + start:
597
597
face.vertices[k] = ix
598
598
point_counts[ix- self .vcount] = count
@@ -653,8 +653,8 @@ cdef class IndexFaceSet(PrimitiveObject):
653
653
"""
654
654
cdef Py_ssize_t i, j
655
655
return [[self ._faces[i].vertices[j]
656
- for j from 0 <= j < self ._faces[i].n]
657
- for i from 0 <= i < self .fcount]
656
+ for j in range ( self ._faces[i].n) ]
657
+ for i in range ( self .fcount) ]
658
658
659
659
def has_local_colors (self ):
660
660
"""
@@ -719,11 +719,11 @@ cdef class IndexFaceSet(PrimitiveObject):
719
719
if self .global_texture:
720
720
raise ValueError (' the texture is global' )
721
721
return [([self ._faces[i].vertices[j]
722
- for j from 0 <= j < self ._faces[i].n],
722
+ for j in range ( self ._faces[i].n) ],
723
723
Color(self ._faces[i].color.r,
724
724
self ._faces[i].color.g,
725
725
self ._faces[i].color.b).html_color())
726
- for i from 0 <= i < self .fcount]
726
+ for i in range ( self .fcount) ]
727
727
728
728
def faces (self ):
729
729
"""
@@ -944,10 +944,10 @@ cdef class IndexFaceSet(PrimitiveObject):
944
944
cdef int * partition = < int * > check_allocarray(self .fcount, sizeof(int ))
945
945
946
946
part_counts = {}
947
- for i from 0 <= i < self .fcount:
947
+ for i in range ( self .fcount) :
948
948
face = & self ._faces[i]
949
949
P = self .vs[face.vertices[0 ]]
950
- for j from 1 <= j < face.n:
950
+ for j in range ( 1 , face.n) :
951
951
point_c_add(& P, P, self .vs[face.vertices[j]])
952
952
point_c_mul(& P, P, 1.0 / face.n)
953
953
partition[i] = part = f(P.x, P.y, P.z)
@@ -964,13 +964,13 @@ cdef class IndexFaceSet(PrimitiveObject):
964
964
memcpy(face_set.vs, self .vs, sizeof(point_c) * self .vcount)
965
965
face_ix = 0
966
966
ix = 0
967
- for i from 0 <= i < self .fcount:
967
+ for i in range ( self .fcount) :
968
968
if partition[i] == part:
969
969
face = & self ._faces[i]
970
970
new_face = & face_set._faces[face_ix]
971
971
new_face.n = face.n
972
972
new_face.vertices = & face_set.face_indices[ix]
973
- for j from 0 <= j < face.n:
973
+ for j in range ( face.n) :
974
974
new_face.vertices[j] = face.vertices[j]
975
975
face_ix += 1
976
976
ix += face.n
@@ -1226,7 +1226,7 @@ cdef class IndexFaceSet(PrimitiveObject):
1226
1226
cdef face_c face
1227
1227
cdef Py_ssize_t i, k
1228
1228
sig_on()
1229
- for i from 0 <= i < self .fcount:
1229
+ for i in range ( self .fcount) :
1230
1230
face = self ._faces[i]
1231
1231
if transform is not None :
1232
1232
transform.transform_point_c(& P, self .vs[face.vertices[0 ]])
@@ -1242,7 +1242,7 @@ cdef class IndexFaceSet(PrimitiveObject):
1242
1242
else :
1243
1243
PyList_Append(lines, format_tachyon_texture(face.color))
1244
1244
if face.n > 3 :
1245
- for k from 3 <= k < face.n:
1245
+ for k in range ( 3 , face.n) :
1246
1246
Q = R
1247
1247
if transform is not None :
1248
1248
transform.transform_point_c(& R, self .vs[face.vertices[k]])
@@ -1290,7 +1290,7 @@ cdef class IndexFaceSet(PrimitiveObject):
1290
1290
for i in range (self .vcount)))
1291
1291
else :
1292
1292
vertices_str = " ["
1293
- for i from 0 <= i < self .vcount:
1293
+ for i in range ( self .vcount) :
1294
1294
transform.transform_point_c(& res, self .vs[i])
1295
1295
if i > 0 :
1296
1296
vertices_str += " ,"
@@ -1408,7 +1408,7 @@ cdef class IndexFaceSet(PrimitiveObject):
1408
1408
vertices = []
1409
1409
cdef Transformation transform = render_params.transform
1410
1410
cdef point_c res
1411
- for i from 0 <= i < self .vcount:
1411
+ for i in range ( self .vcount) :
1412
1412
if transform is None :
1413
1413
res = self .vs[i]
1414
1414
else :
@@ -1418,16 +1418,16 @@ cdef class IndexFaceSet(PrimitiveObject):
1418
1418
1419
1419
faces = []
1420
1420
cdef face_c face
1421
- for i from 0 <= i < self .fcount:
1421
+ for i in range ( self .fcount) :
1422
1422
face = self ._faces[i]
1423
- faces.append([int (face.vertices[j]) for j from 0 <= j < face.n])
1423
+ faces.append([int (face.vertices[j]) for j in range ( face.n) ])
1424
1424
surface[' faces' ] = faces
1425
1425
1426
1426
if self .global_texture:
1427
1427
surface[' color' ] = ' #' + str (self .texture.hex_rgb())
1428
1428
else :
1429
1429
face_colors = []
1430
- for i from 0 <= i < self .fcount:
1430
+ for i in range ( self .fcount) :
1431
1431
face = self ._faces[i]
1432
1432
color = Color(face.color.r, face.color.g, face.color.b)
1433
1433
face_colors.append(str (color.html_color()))
@@ -1472,16 +1472,16 @@ cdef class IndexFaceSet(PrimitiveObject):
1472
1472
1473
1473
sig_on()
1474
1474
if transform is None :
1475
- points = [format_obj_vertex(self .vs[i]) for i from 0 <= i < self .vcount]
1475
+ points = [format_obj_vertex(self .vs[i]) for i in range ( self .vcount) ]
1476
1476
else :
1477
1477
points = []
1478
- for i from 0 <= i < self .vcount:
1478
+ for i in range ( self .vcount) :
1479
1479
transform.transform_point_c(& res, self .vs[i])
1480
1480
PyList_Append(points, format_obj_vertex(res))
1481
1481
1482
- faces = [format_obj_face(self ._faces[i], off) for i from 0 <= i < self .fcount]
1482
+ faces = [format_obj_face(self ._faces[i], off) for i in range ( self .fcount) ]
1483
1483
if not self .enclosed:
1484
- back_faces = [format_obj_face_back(self ._faces[i], off) for i from 0 <= i < self .fcount]
1484
+ back_faces = [format_obj_face_back(self ._faces[i], off) for i in range ( self .fcount) ]
1485
1485
else :
1486
1486
back_faces = []
1487
1487
@@ -1513,25 +1513,25 @@ cdef class IndexFaceSet(PrimitiveObject):
1513
1513
sig_on()
1514
1514
if transform is None :
1515
1515
points = [format_pmesh_vertex(self .vs[i])
1516
- for i from 0 <= i < self .vcount]
1516
+ for i in range ( self .vcount) ]
1517
1517
else :
1518
1518
points = []
1519
- for i from 0 <= i < self .vcount:
1519
+ for i in range ( self .vcount) :
1520
1520
transform.transform_point_c(& res, self .vs[i])
1521
1521
PyList_Append(points, format_pmesh_vertex(res))
1522
1522
1523
1523
# activation of coloring in jmol
1524
1524
if self .global_texture:
1525
1525
faces = [format_pmesh_face(self ._faces[i], 1 )
1526
- for i from 0 <= i < self .fcount]
1526
+ for i in range ( self .fcount) ]
1527
1527
else :
1528
1528
faces = [format_pmesh_face(self ._faces[i], - 1 )
1529
- for i from 0 <= i < self .fcount]
1529
+ for i in range ( self .fcount) ]
1530
1530
1531
1531
# If a face has more than 4 vertices, it gets chopped up in
1532
1532
# format_pmesh_face
1533
1533
cdef Py_ssize_t extra_faces = 0
1534
- for i from 0 <= i < self .fcount:
1534
+ for i in range ( self .fcount) :
1535
1535
if self ._faces[i].n >= 5 :
1536
1536
extra_faces += self ._faces[i].n- 3
1537
1537
@@ -1641,14 +1641,14 @@ cdef class IndexFaceSet(PrimitiveObject):
1641
1641
dual.realloc(self .fcount, self .vcount, self .icount)
1642
1642
1643
1643
# is using dicts overly-heavy?
1644
- dual_faces = [{} for i from 0 <= i < self .vcount]
1644
+ dual_faces = [{} for i in range ( self .vcount) ]
1645
1645
1646
- for i from 0 <= i < self .fcount:
1646
+ for i in range ( self .fcount) :
1647
1647
sig_check()
1648
1648
# Let the vertex be centered on the face according to a simple average
1649
1649
face = & self ._faces[i]
1650
1650
dual.vs[i] = self .vs[face.vertices[0 ]]
1651
- for j from 1 <= j < face.n:
1651
+ for j in range ( 1 , face.n) :
1652
1652
point_c_add(& dual.vs[i], dual.vs[i], self .vs[face.vertices[j]])
1653
1653
point_c_mul(& dual.vs[i], dual.vs[i], 1.0 / face.n)
1654
1654
@@ -1676,7 +1676,7 @@ cdef class IndexFaceSet(PrimitiveObject):
1676
1676
face.vertices = & dual.face_indices[ix]
1677
1677
ff, next_ = next(iter (dd.itervalues()))
1678
1678
face.vertices[0 ] = ff
1679
- for j from 1 <= j < face.n:
1679
+ for j in range ( 1 , face.n) :
1680
1680
ff, next_ = dd[next_]
1681
1681
face.vertices[j] = ff
1682
1682
i += 1
@@ -1764,7 +1764,7 @@ cdef class FaceIter:
1764
1764
raise StopIteration
1765
1765
else :
1766
1766
face = []
1767
- for j from 0 <= j < self .set._faces[self .i].n:
1767
+ for j in range ( self .set._faces[self .i].n) :
1768
1768
P = self .set.vs[self .set._faces[self .i].vertices[j]]
1769
1769
PyList_Append(face, (P.x, P.y, P.z))
1770
1770
self .i += 1
0 commit comments