예제 #1
0
def seg_offset(seg, d):
    th0 = seg.th(0)
    th1 = seg.th(seg.arclen)
    z0 = [seg.z0[0] + d * sin(th0), seg.z0[1] - d * cos(th0)]
    z1 = [seg.z1[0] + d * sin(th1), seg.z1[1] - d * cos(th1)]
    chth = atan2(z1[1] - z0[1], z1[0] - z0[0])
    return [pcorn.Segment(z0, z1, mod_2pi(chth - th0), mod_2pi(th1 - chth))]
예제 #2
0
def seg_offset(seg, d):
    th0 = seg.th(0)
    th1 = seg.th(seg.arclen)
    z0 = [seg.z0[0] + d * sin(th0), seg.z0[1] - d * cos(th0)]
    z1 = [seg.z1[0] + d * sin(th1), seg.z1[1] - d * cos(th1)]
    chth = atan2(z1[1] - z0[1], z1[0] - z0[0])
    return [pcorn.Segment(z0, z1, mod_2pi(chth - th0), mod_2pi(th1 - chth))]
예제 #3
0
 def find_breaks(self):
     result = []
     for i in range(len(self.segs)):
         pseg = self.segs[(i + len(self.segs) - 1) % len(self.segs)]
         seg = self.segs[i]
         th = clothoid.mod_2pi(pseg.chth + pseg.th1 - (seg.chth - seg.th0))
         print '% pseg', pseg.chth + pseg.th1, 'seg', seg.chth - seg.th0
         pisline = pseg.k0 == 0 and pseg.k1 == 0
         sisline = seg.k0 == 0 and seg.k1 == 0
         if fabs(th) > 1e-3 or (pisline and not sisline) or (sisline and not pisline):
             result.append(self.sstarts[i])
     return result
예제 #4
0
 def find_breaks(self):
     result = []
     for i in range(len(self.segs)):
         pseg = self.segs[(i + len(self.segs) - 1) % len(self.segs)]
         seg = self.segs[i]
         th = clothoid.mod_2pi(pseg.chth + pseg.th1 - (seg.chth - seg.th0))
         print('% pseg', pseg.chth + pseg.th1, 'seg', seg.chth - seg.th0)
         pisline = pseg.k0 == 0 and pseg.k1 == 0
         sisline = seg.k0 == 0 and seg.k1 == 0
         if fabs(th) > 1e-3 or (pisline and not sisline) or (sisline and not pisline):
             result.append(self.sstarts[i])
     return result