[fix] kaleidoscope should not ignore the last point of the original list

This commit is contained in:
alban 2020-09-29 23:39:09 +02:00
parent 59a8dfe4b3
commit 3dff5d92af

View File

@ -52,11 +52,21 @@ def kaleidoscope( pl ):
# Stage 1: Crop points in single quadrant
quad1 = []
# Iterate trough the segments
for i in range( 0, len(pl) - 1 ):
for i in range( 0, len(pl) ):
#debug(name+" point #", i)
currentpoint = cp = pl[i]
nextpoint = pl[i+1]
cx,cy,cc = [cp[0],cp[1],cp[2]]
# Exception: escape early if last point
if i == len(pl) - 1:
if cx >= centerX and cy >= centerY :
quad1.append( currentpoint )
break
# Search for the couple of points
nextpoint = pl[i+1]
nx,ny,nc = [nextpoint[0],nextpoint[1],nextpoint[2]]
rect=[[cx,cy],[cx,ny],[nx,ny],[nx,cy]]
@ -134,7 +144,7 @@ def kaleidoscope( pl ):
point = quad3[iterator]
quad4.append([ 2*centerX - point[0], point[1], point[2] ])
#debug(name+" quad1:",quad1)
debug(name+" quad1:",quad1)
#debug(name+" quad2:", quad2 )
debug(name+" quad3:", quad3 )
debug(name+" quad4:", quad4 )