|
@@ -626,25 +626,44 @@ class ApplicationWindow(QtWidgets.QMainWindow):
|
626
|
626
|
iclosest = iseg
|
627
|
627
|
|
628
|
628
|
points = np.concatenate([points[iclosest::],points[0:iclosest]])
|
|
629
|
+
|
|
630
|
+ # Fill first loop
|
629
|
631
|
point1 = False
|
630
|
632
|
for iseg, ipt in enumerate(points):
|
631
|
633
|
if cwise == 0:
|
632
|
634
|
self.loops[self.ui.loopLabel.text()].SetPoint(iseg, ( cn1+rad*np.sin(ipt), ce1+rad*np.cos(ipt), ht) )
|
|
635
|
+ pointlast = ( cn1+rad*np.sin(ipt), ce1+rad*np.cos(ipt), ht)
|
633
|
636
|
if not point1:
|
634
|
637
|
point1 = ( cn1+rad*np.sin(ipt), ce1+rad*np.cos(ipt), ht)
|
635
|
638
|
else:
|
636
|
639
|
self.loops[self.ui.loopLabel.text()].SetPoint(iseg, ( cn1-rad*np.sin(ipt), ce1+rad*np.cos(ipt), ht) )
|
637
|
640
|
if not point1:
|
638
|
641
|
point1 = ( cn1-rad*np.sin(ipt), ce1+rad*np.cos(ipt), ht)
|
|
642
|
+ pointlast = ( cn1-rad*np.sin(ipt), ce1+rad*np.cos(ipt), ht)
|
639
|
643
|
|
640
|
644
|
lenP = len(points)
|
641
|
645
|
|
642
|
|
- # fill
|
|
646
|
+ # reorder points again to find nearest point in second loop
|
|
647
|
+ closest = 99999
|
|
648
|
+ iclosest = -1
|
|
649
|
+ for iseg, ipt in enumerate(points):
|
|
650
|
+ if cwise == 0:
|
|
651
|
+ p2 = np.array([cn2-rad*np.sin(ipt), ce2+rad*np.cos(ipt)])
|
|
652
|
+ else:
|
|
653
|
+ p2 = np.array([cn2+rad*np.sin(ipt), ce2+rad*np.cos(ipt)])
|
|
654
|
+ for p1 in ptsL:
|
|
655
|
+ dist = np.linalg.norm(np.array(pointlast[0:2])-p2)
|
|
656
|
+ if dist < closest:
|
|
657
|
+ closest = dist
|
|
658
|
+ iclosest = iseg
|
|
659
|
+ points = np.concatenate([points[iclosest::],points[0:iclosest]])
|
|
660
|
+
|
|
661
|
+ # fill second loop
|
643
|
662
|
for iseg, ipt in enumerate(points):
|
644
|
663
|
if cwise == 0:
|
645
|
|
- self.loops[self.ui.loopLabel.text()].SetPoint(lenP+iseg, ( cn2-rad*np.cos(ipt), ce2-rad*np.sin(ipt), ht) )
|
|
664
|
+ self.loops[self.ui.loopLabel.text()].SetPoint(lenP+iseg, ( cn2-rad*np.sin(ipt), ce2+rad*np.cos(ipt), ht) )
|
646
|
665
|
else:
|
647
|
|
- self.loops[self.ui.loopLabel.text()].SetPoint(lenP+iseg, ( cn2+rad*np.cos(ipt), ce2+rad*np.sin(ipt), ht) )
|
|
666
|
+ self.loops[self.ui.loopLabel.text()].SetPoint(lenP+iseg, ( cn2+rad*np.sin(ipt), ce2+rad*np.cos(ipt), ht) )
|
648
|
667
|
|
649
|
668
|
# close loop
|
650
|
669
|
self.loops[self.ui.loopLabel.text()].SetPoint(lenP+iseg+1, point1)
|