프로젝트

일반

사용자정보

개정판 730e6a4f

ID730e6a4fe36cf3c5e609fdd62c157e94e6f300ac
상위 17345074
하위 59f71a7a

humkyung 이(가) 약 7년 전에 추가함

Add Splitter widget

차이점 보기:

DTI_PID/DTI_PID/LineDetector.py
291 291
        @date       2018.04.??
292 292
        @history    humkyung 2018.04.11 merge lines which are collinear or connected    
293 293
        @history    humkyung 2018.04.12 rotate connection points by symbol angle
294
        @history    humkyung 2018.04.12 use connection points without rotation(already rotated)
294 295
    '''
295 296
    def detectConnectedLine(self, symbol, offsetX, offsetY):
296 297
        res = []
......
299 300
            pool = []
300 301
            if (0 == symbol.angle) or (1.57 == symbol.angle) or (3.14 == symbol.angle) or (4.71 == symbol.angle):
301 302
                for conn in symbol.connPts:
302
                    pt = self.rotatePoint(conn, symbol.origin, symbol.angle)
303
                    dx = pt[0] - symbol.origin[0]
304
                    dy = pt[1] - symbol.origin[1]
303
                    dx = conn[0] - symbol.origin[0]
304
                    dy = conn[1] - symbol.origin[1]
305 305
                    length = math.sqrt(dx*dx + dy*dy)
306 306
                    dx /= length
307 307
                    dy /= length
308 308

  
309 309
                    if abs(dx) < 0.1:
310
                        pool.append([[0,1 if dy > 0 else -1], [round(pt[0] - offsetX), round(pt[1] - offsetY)]])
310
                        pool.append([[0,1 if dy > 0 else -1], [round(conn[0] - offsetX), round(conn[1] - offsetY)]])
311 311
                    elif abs(dy) < 0.1:
312
                        pool.append([[1 if dx > 0 else -1,0], [round(pt[0] - offsetX), round(pt[1] - offsetY)]])
312
                        pool.append([[1 if dx > 0 else -1,0], [round(conn[0] - offsetX), round(conn[1] - offsetY)]])
313 313

  
314 314
            while len(pool) > 0:
315 315
                dir, pt = pool.pop()

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)