<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      剔除自相交線上的環

      
      
      import numpy as np
      from functools import partial
      from shapely.geometry import Point, LineString
      from shapely.ops import substring, linemerge
      from shapely.ops import unary_union
      from itertools import combinations
      class removeRingOnLineSting():
          # 去除自相交線上的小環
          # 基本思路 1 定位自相交點 2 自相交點分割線 3 分割線合并 根據長度篩選最長的兩個
          # todo1 環上環
          def __init__(self, ls, torelance=30):
              self.ls = ls
              self.torelance = torelance
              self.cp = self.crossPoint()
      
          def crossPoint(self):
              # 定位自相交點
              N = int(self.ls.length / self.torelance)
              sp = np.linspace(0, 1, N)[1:-1]
              pfun = partial(substring, geom=self.ls, normalized=1)
              cp = set()
              for p in sp:
                  t1 = pfun(start_dist=0, end_dist=p)
                  tp = pfun(start_dist=p, end_dist=p)
                  t2 = pfun(start_dist=p, end_dist=1)
      
                  if not t1.touches(t2):
                      mp = [_ for _ in t1.intersection(t2).geoms if _ != tp]
                      cp.update(mp)
      
              tx = lambda x: round(x, 3)
              cp = [(tx(p.x), tx(p.y)) for p in cp]
              cp = set([Point(_) for _ in cp])
              return cp
      
          def removeRing(self):
      
              spliter = [p.buffer(self.torelance) for p in self.cp]
              spliter = unary_union(spliter)
              mls = self.ls.symmetric_difference(spliter)  # 自相交點緩沖裁剪線
              mls = [_ for _ in mls.geoms if _.geom_type == 'LineString']  # 過濾
              mls = self.spliterFilter(mls)  # 過濾環 及 自相交點附近的線
              rls = self.mergeLinesWithGap(mls)  # 合并剩余的線
      
              return rls
      
          def spliterFilter(self, geoms):
              # 把起點和終點都在spliter附近的部分過濾掉
              # 思想是計算起點和終點之間的距離
              pfun = lambda x: substring(x, start_dist=0, end_dist=0, normalized=1)
              ptun = lambda x: substring(x, start_dist=1, end_dist=1, normalized=1)
              flag = [pfun(_).distance(ptun(_)) >= self.torelance * 2 for _ in geoms]
              geoms = [g for g, _ in zip(geoms, flag) if _]
              return geoms
      
          def mergeLinesWithGap(self, lines):
              pfun = lambda x: substring(x, start_dist=0, end_dist=0, normalized=1)
              ptun = lambda x: substring(x, start_dist=1, end_dist=1, normalized=1)
              fps = ((i, pfun(_)) for i, _ in enumerate(lines))
              tps = ((j, ptun(_)) for j, _ in enumerate(lines))
              ftp = list(fps) + list(tps)
              tt = combinations(ftp, 2)
              para = ((f, t) for (i, f), (j, t) in tt if i != j)
              para = ((f, t) for f, t in para if f.distance(t) <= self.torelance * 2)
              gap_line = [LineString(_) for _ in para]
              gap_line.extend(lines)
              return linemerge(gap_line)
          
      
      if __name__ == '__main__':
      
          pnts = [(-7,0), (1,0), (1,1), (0,1), (0,-2), (-1,-2),(-1,-1),(7,-1)]
          ls = LineString(pnts)
          
          algo = removeRingOnLineSting(ls, torelance=0.2)
          rls = algo.removeRing()  # LINESTRING (-7 0, -0.2 0, 0 -0.2, 0 -0.8, 0.2 -1, 7 -1)
          print(rls.wkt)
      
      

       

       

       

      posted @ 2024-03-08 17:16  ddzhen  閱讀(79)  評論(0)    收藏  舉報
      主站蜘蛛池模板: av无码精品一区二区乱子| 国产精品亚洲二区在线播放| 乱人伦中文字幕成人网站在线| 亚洲精品天堂在线观看| www久久只有这里有精品| 亚洲高清aⅴ日本欧美视频| 东京热人妻无码一区二区AV| 荥阳市| 国产午夜亚洲精品福利| 国产成人毛片无码视频软件| 白嫩少妇激情无码| 国产超碰人人爽人人做人人添| 一道本AV免费不卡播放| 久热伊人精品国产中文| 日日碰狠狠躁久久躁96avv| 东京热人妻无码一区二区AV| A毛片终身免费观看网站| 亚洲av色夜色精品一区| 亚洲色一区二区三区四区| 国产午夜福利精品视频| 亚洲综合久久国产一区二区| 在线天堂最新版资源| 中文字幕色av一区二区三区| 国产福利社区一区二区| 亚洲日本乱码在线观看| 中文字幕久无码免费久久| 免费A级毛片中文字幕| 亚洲中文字幕国产综合| 国产黄色一级片在线观看| 国产精品污双胞胎在线观看| 深夜福利啪啪片| 国产av国片精品一区二区| 国产真人性做爰久久网站 | 777奇米四色成人影视色区| 九九热精品在线观看 | 浏阳市| 在线观看无码av五月花| 国产精品乱码高清在线观看| 精品久久久久久无码不卡| 国产精品午夜福利片国产| 中文字幕av无码一区二区三区 |